Package smisk :: Module session :: Class Store
[frames] | no frames]

Class Store

Session store interface definition.
Instance Methods
object
read(self, session_id)
Return the data associated with a session id.
None
write(self, session_id, data)
Associate data with a session id.
None
refresh(self, session_id)
Refresh session.
None
destroy(self, session_id)
Destroy/delete/invalidate any session associated with session_id.
Class Variables
int ttl = 900
string name = 'SID'
Method Details

read(self, session_id)

 

Return the data associated with a session id.

Called maximum once per HTTP transaction.

If there is no session associated with session_id, this method is responsible for and session initialization required by the underyling storage model.

In the case where there is no data previously associated with the session id, this method should return None.

Parameters:
  • session_id (string) - Session ID
Returns: object

write(self, session_id, data)

 

Associate data with a session id.

Called at least once per HTTP transaction which has an active session.

Normally, this will be called once, at the end of the HTTP transaction. This method should associate data with session_id.

Parameters:
  • session_id (string) - Session ID
  • data (object) - Data to be associated with session_id
Returns: None

refresh(self, session_id)

 

Refresh session.

Called when a session is known to be in active use but has not been modified.

For example, the built-in file-based session stores implementation uses touch session-file in order to refresh the sessions modified time, which is later used in the garbage collector-based model to detect dead sessions.

Parameters:
  • session_id (string) - Session ID
Returns: None

destroy(self, session_id)

 

Destroy/delete/invalidate any session associated with session_id.

May be called any number of times during a HTTP transaction.

Parameters:
  • session_id (string) - Session ID
Returns: None