SessionServiceInterface
extends
DbServiceInterface
in
Database service interface for Session.
Tags
Table of Contents
- createEntity() : SessionEntityInterface
- Create a session entity object.
- destroySession() : void
- Destroy data for the given session ID.
- garbageCollect() : int
- Garbage collect expired sessions. Returns number of deleted rows.
- getSessionById() : SessionEntityInterface|null
- Retrieve an object from the database based on session ID; create a new row if no existing match is found.
- persistEntity() : void
- Persist an entity.
- readSession() : string
- Retrieve data for the given session ID.
- writeSession() : bool
- Store data for the given session ID.
Methods
createEntity()
Create a session entity object.
public
createEntity() : SessionEntityInterface
Return values
SessionEntityInterface —destroySession()
Destroy data for the given session ID.
public
destroySession(string $sid) : void
Parameters
- $sid : string
-
Session ID to erase
Return values
void —garbageCollect()
Garbage collect expired sessions. Returns number of deleted rows.
public
garbageCollect(int $maxLifetime) : int
Parameters
- $maxLifetime : int
-
Maximum session lifetime.
Return values
int —getSessionById()
Retrieve an object from the database based on session ID; create a new row if no existing match is found.
public
getSessionById(string $sid[, bool $create = true ]) : SessionEntityInterface|null
Parameters
- $sid : string
-
Session ID to retrieve
- $create : bool = true
-
Should we create rows that don't already exist?
Return values
SessionEntityInterface|null —persistEntity()
Persist an entity.
public
persistEntity(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
Entity to persist.
Return values
void —readSession()
Retrieve data for the given session ID.
public
readSession(string $sid, int $lifetime) : string
Parameters
- $sid : string
-
Session ID to retrieve
- $lifetime : int
-
Session lifetime (in seconds)
Tags
Return values
string —Session data
writeSession()
Store data for the given session ID.
public
writeSession(string $sid, string $data) : bool
Parameters
- $sid : string
-
Session ID to retrieve
- $data : string
-
Data to store