TransientSession
class TransientSession implements SessionInterface (View source)
Implementation of a transient session.
This session behaves like any other session except that it only stores the data during one request.
Properties
protected string | $sessionId | The session Id |
|
protected bool | $started | If this session has been started |
|
protected array | $data | The session data |
|
protected int | $lastActivityTimestamp | ||
protected array | $tags |
Methods
Tells if the session has been started already.
Starts the session, if it has not been already started
Returns true if there is a session that can be resumed. false otherwise
Resumes an existing session, if any.
Generates and propagates a new session ID and transfers all existing data to the new session.
Returns the current session ID.
Returns the data associated with the given key.
Returns true if $key is available.
Stores the given data under the given key in the session
Closes the session
Explicitly destroys all session data
No operation for transient session.
Returns the unix time stamp marking the last point in time this session has been in use.
Updates the last activity time to "now".
Tags this session with the given tag.
Removes the specified tag from this session.
Returns the tags this session has been tagged with.
Details
bool
isStarted()
Tells if the session has been started already.
void
start()
Starts the session, if it has not been already started
bool
canBeResumed()
Returns true if there is a session that can be resumed. false otherwise
void
resume()
Resumes an existing session, if any.
string
renewId()
Generates and propagates a new session ID and transfers all existing data to the new session.
string
getId()
Returns the current session ID.
mixed
getData(string $key)
Returns the data associated with the given key.
bool
hasKey(string $key)
Returns true if $key is available.
void
putData(string $key, mixed $data)
Stores the given data under the given key in the session
void
close()
Closes the session
void
destroy(string $reason = null)
Explicitly destroys all session data
static void
destroyAll(Bootstrap $bootstrap)
No operation for transient session.
int
collectGarbage()
No operation for transient session.
int
getLastActivityTimestamp()
Returns the unix time stamp marking the last point in time this session has been in use.
void
touch()
Updates the last activity time to "now".
void
addTag(string $tag)
Tags this session with the given tag.
Note that third-party libraries might also tag your session. Therefore it is recommended to use namespaced tags such as "Acme-Demo-MySpecialTag".
void
removeTag(string $tag)
Removes the specified tag from this session.
array
getTags()
Returns the tags this session has been tagged with.