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 | $sessionId | ||
protected | $started | ||
protected | $data | ||
protected | $lastActivityTimestamp | ||
protected | $tags |
Methods
Tells if the session has been started already.
No description
Returns true if there is a session that can be resumed. false otherwise
No description
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
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()
No description
bool
canBeResumed()
Returns true if there is a session that can be resumed. false otherwise
int|null
resume()
No description
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|null $reason = null)
Explicitly destroys all session data
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.