DatabaseSessionHandler
class DatabaseSessionHandler extends AbstractSessionHandler (View source)
Session save handler that stores session data in the database.
Traits
Provides extensions to this object to integrate it with standard config API methods.
Config options
table_name | string |
Properties
Methods
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Add the database table. This is called by an extension when building the db.
Details
protected int
getLifetime()
Get the session lifetime in seconds.
Returns the cookie lifetime if it's non-zero, otherwise returns the garbage collection lifetime.
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
bool
open(string $path, string $name)
No description
bool
close()
No description
bool
destroy(string $id)
No description
int|false
gc(int $max_lifetime)
No description
string|false
read(string $id)
No description
bool
write(string $id, string $data)
No description
bool
validateId(string $id)
No description
bool
updateTimestamp(string $id, string $data)
No description
void
requireTable()
Add the database table. This is called by an extension when building the db.
Note that we don't just use a DataObject because:
- We don't want things like versioning, fluent, etc to ever be able to affect sessions
- We don't want developers to be affecting db operations via hooks (interact with sessions with the Session class)
- We don't want sessions to be used in any other ways that DataObjects are often
- We only want to build the table if this is the configured save handler