Package session2 :: Package store :: Module SessionStore :: Class SessionStore
[frames | no frames]

Class SessionStore

Known Subclasses:
DirectorySessionStore, DurusSessionStore, MySQLSessionStore, PostgresSessionStore, ShelveSessionStore, VolatileSessionStore

Persistent Session storage API for session2's SessionManager.

Subclass this class & provide implementations of load_session, save_session, and delete_session, and voila, persistent sessions!


Method Summary
  delete_old_sessions(self, minutes)
Delete all sessions that have not been modified for N minutes.
  delete_session(self, session)
Delete the session in the store.
  has_session(self, id)
Return true if the session exists in the store, else false.
  iter_sessions(self)
Return an iterable of (id, session) for all sessions in the store.
  load_session(self, id, default)
Return the session if it exists, else return 'default'.
  save_session(self, session)
Save the session in the store.
  setup(self)
Initialize the session store; e.g., create required database tables.

Class Variable Summary
bool is_multiprocess_safe = False
bool is_thread_safe = False

Method Details

delete_old_sessions(self, minutes)

Delete all sessions that have not been modified for N minutes. The default implementation does nothing, meaning the store cannot delete old sessions.

This method is never called by the session manager. It's for your application maintenance program; e.g., a daily cron job.

delete_session(self, session)

Delete the session in the store.

has_session(self, id)

Return true if the session exists in the store, else false.

iter_sessions(self)

Return an iterable of (id, session) for all sessions in the store.

This method is never called by the session manager; it's for admin applications that want to browse the sessions.

load_session(self, id, default=None)

Return the session if it exists, else return 'default'.

save_session(self, session)

Save the session in the store.

setup(self)

Initialize the session store; e.g., create required database tables. If a previous store exists, overwrite it or raise an error. The default implmenetation does nothing, meaning no setup is necessary.

This method is never called by the session manager; it's for your application setup program.


Class Variable Details

is_multiprocess_safe

Type:
bool
Value:
False                                                                  

is_thread_safe

Type:
bool
Value:
False                                                                  

Generated by Epydoc 2.1 on Sat Feb 4 16:40:10 2006 http://epydoc.sf.net