PHP Interface Neos\Flow\Session\SessionInterface

Exibir arquivo Open project: neos/flow-development-collection Interface Usage Examples

Public Methods

Method Description
addTag ( string $tag ) : void Tags this session with the given tag.
canBeResumed ( ) : boolean Returns TRUE if there is a session that can be resumed. FALSE otherwise
close ( ) : void Explicitly writes (persists) and closes the session
collectGarbage ( ) : integer Remove data of all sessions which are considered to be expired.
destroy ( string $reason = null ) : void Explicitly destroys all session data
getData ( string $key ) : array Returns the contents (array) associated with the given key.
getId ( ) : string Returns the current session ID.
getLastActivityTimestamp ( ) : integer Returns the unix time stamp marking the last point in time this session has been in use.
getTags ( ) : array Returns the tags this session has been tagged with.
hasKey ( string $key ) : boolean Returns TRUE if $key is available.
isStarted ( ) : boolean Tells if the session has been started already.
putData ( string $key, mixed $data ) : void Stores the given data under the given key in the session
removeTag ( string $tag ) : void Removes the specified tag from this session.
renewId ( ) : string Generates and propagates a new session ID and transfers all existing data to the new session.
resume ( ) : void Resumes an existing session, if any.
start ( ) : void Starts the session, if is has not been already started
touch ( ) : void Updates the last activity time to "now".

Method Details

addTag() public method

Note that third-party libraries might also tag your session. Therefore it is recommended to use namespaced tags such as "Acme-Demo-MySpecialTag".
public addTag ( string $tag ) : void
$tag string The tag – must match be a valid cache frontend tag
return void

canBeResumed() public method

Returns TRUE if there is a session that can be resumed. FALSE otherwise
public canBeResumed ( ) : boolean
return boolean

close() public method

Explicitly writes (persists) and closes the session
public close ( ) : void
return void

collectGarbage() public method

Remove data of all sessions which are considered to be expired.
public collectGarbage ( ) : integer
return integer The number of outdated entries removed or NULL if no such information could be determined

destroy() public method

Explicitly destroys all session data
public destroy ( string $reason = null ) : void
$reason string A reason for destroying the session – used by the LoggingAspect
return void

getData() public method

Returns the contents (array) associated with the given key.
public getData ( string $key ) : array
$key string An identifier for the content stored in the session.
return array The contents associated with the given key

getId() public method

Returns the current session ID.
public getId ( ) : string
return string The current session ID

getLastActivityTimestamp() public method

For the current (local) session, this method will always return the current time. For a remote session, the unix timestamp will be returned.
public getLastActivityTimestamp ( ) : integer
return integer unix timestamp

getTags() public method

Returns the tags this session has been tagged with.
public getTags ( ) : array
return array The tags or an empty array if there aren't any

hasKey() public method

Returns TRUE if $key is available.
public hasKey ( string $key ) : boolean
$key string
return boolean

isStarted() public method

Tells if the session has been started already.
public isStarted ( ) : boolean
return boolean

putData() public method

Stores the given data under the given key in the session
public putData ( string $key, mixed $data ) : void
$key string The key under which the data should be stored
$data mixed The data to be stored
return void

removeTag() public method

Removes the specified tag from this session.
public removeTag ( string $tag ) : void
$tag string The tag – must match be a valid cache frontend tag
return void

renewId() public method

Renewing the session ID is one counter measure against Session Fixation Attacks.
public renewId ( ) : string
return string The new session ID

resume() public method

Resumes an existing session, if any.
public resume ( ) : void
return void

start() public method

Starts the session, if is has not been already started
public start ( ) : void
return void

touch() public method

Updates the last activity time to "now".
public touch ( ) : void
return void