For my Symfony2 project, i'm using the session storage in a database.
So, i configure my config.yml like that :
framework:
session:
handler_id: session.handler.pdo
parameters:
pdo.db_options:
db_table: session
db_id_col: session_id
db_data_col: session_value
db_time_col: session_time
services:
pdo:
class: PDO
arguments:
- "pgsql:host=%database_host%;dbname=%database_name%"
- "%database_user%"
- "%database_password%"
calls:
- [setAttribute, [3, 2]]
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
arguments: ["@pdo", "%pdo.db_options%"]
When i login with an account, a new ligne is created in my session table, normal. But when i display a page of my website with nothing (just the index for example), a new line is created too.
So, with 4-5 members, i already have +80 lines of sessions in table...
How can i do that ? I only need a line when a member login.