WebKit.SessionDynamicStore | index /usr/local/share/webware/WebKit/SessionDynamicStore.py

`Session store using memory and files.`

Modules

``

WebKit.SessionFileStore | WebKit.SessionMemoryStore | threading | time

Classes

``

WebKit.SessionStore.SessionStore(__builtin__.object)
  SessionDynamicStore

class SessionDynamicStore(WebKit.SessionStore.SessionStore)

``

`Stores the session in memory and in files.
This can be used either in a persistent app server or a cgi framework.
To use this Session Store, set SessionStore in Application.config
to 'Dynamic'. Other variables which can be set in Application.config are:
'MaxDynamicMemorySessions', which sets the maximum number of sessions
that can be in memory at one time. Default is 10,000.
'DynamicSessionTimeout', which sets the default time for a session to stay
in memory with no activity. Default is 15 minutes. When specifying this in
Application.config, use minutes.
One-shot sessions (usually created by crawler bots) aren't moved to
FileStore on periodical clean-up. They are still saved on SessionStore
shutdown. This reduces the number of files in the Sessions directory.
`

Method resolution order:
  SessionDynamicStore
  WebKit.SessionStore.SessionStore
  __builtin__.object

Methods defined here:

__contains__(self, key)
  `Check whether the session store has a given key.`

__delitem__(self, key)
  `Delete a session item from the memory and the file store.`

__getitem__(self, key)
  `Get a session item from the store.`

__init__(self, app)
  `Create both a file and a memory store.`

__iter__(self)
  `Return an iterator over the stored session keys.`

__len__(self)
  `Return the number of sessions in the store.`

__setitem__(self, key, value)
  `Set a sessing item, saving it to the memory store for now.`

cleanStaleSessions(self, task=None)
  `Clean stale sessions.
  Called by the Application to tell this store to clean out all sessions
  that have exceeded their lifetime.
  We want to have their native class functions handle it, though.
  Ideally, intervalSweep would be run more often than the
  cleanStaleSessions functions for the actual stores.
  This may need to wait until we get the TaskKit in place, though.
  The problem is the FileStore.cleanStaleSessions can take a while to run.
  So here, we only run the file sweep every fourth time.`

clear(self)
  `Clear the session store in memory and remove all session files.`

intervalSweep(self)
  `The session sweeper interval function.
  The interval function moves sessions from memory to file
  and can be run more often than the full cleanStaleSessions function.`

keys(self)
  `Return a list with all keys of all the stored sessions.`

memoryKeysInAccessTimeOrder(self)
  `Return memory store's keys in ascending order of last access time.`

moveToFile(self, key)
  `Move the value for a session from memory to file.`

moveToMemory(self, key)
  `Move the value for a session from file to memory.`

pop(self, key, default=<class 'MiscUtils.NoDefault'>)
  `Return value if key available, else default (also remove key).`

setEncoderDecoder(self, encoder, decoder)
  `Set the serializer and deserializer for the store.`

setdefault(self, key, default=None)
  `Return value if key available, else default (also setting it).`

storeAllSessions(self)
  `Permanently save all sessions in the store.`

storeSession(self, session)
  `Save potentially changed session in the store.`

Methods inherited from WebKit.SessionStore.SessionStore:

__repr__(self)
  `Return string representation of the store like a dictionary.`

application(self)
  `Return the application owning the session store.`

decoder(self)
  `Return the value deserializer for the store.`

encoder(self)
  `Return the value serializer for the store.`

get(self, key, default=None)
  `Return value if key available, else return the default.`

has_key(self, key)
  `Check whether the session store has a given key.`

items(self)
  `Return a list with the (key, value) pairs for all sessions.`

iteritems(self)
  `Return an iterator over the (key, value) pairs for all sessions.`

iterkeys(self)
  `Return an iterator over the stored session keys.`

itervalues(self)
  `Return an iterator over the stored values of all sessions.`

values(self)
  `Return a list with the values of all stored sessions.`

Data descriptors inherited from WebKit.SessionStore.SessionStore:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Data
`` |  | debug = False