Container and Namespace classes
Bases: beaker.container.OpenResourceNamespaceManager
NamespaceManager that uses dbm files for storage.
Bases: beaker.container.OpenResourceNamespaceManager
NamespaceManager that uses binary files for storage.
Each namespace is implemented as a single file storing a dictionary of key/value pairs, serialized using the Python pickle module.
Bases: beaker.container.AbstractDictionaryNSManager
NamespaceManager that uses a Python dictionary for storage.
Handles dictionary operations and locking for a namespace of values.
NamespaceManager provides a dictionary-like interface, implementing __getitem__(), __setitem__(), and __contains__(), as well as functions related to lock acquisition.
The implementation for setting and retrieving the namespace data is handled by subclasses.
NamespaceManager may be used alone, or may be accessed by one or more Value objects. Value objects provide per-key services like expiration times and automatic recreation of values.
Multiple NamespaceManagers created with a particular name will all share access to the same underlying datasource and will attempt to synchronize against a common mutex object. The scope of this sharing may be within a single process or across multiple processes, depending on the type of NamespaceManager used.
The NamespaceManager itself is generally threadsafe, except in the case of the DBMNamespaceManager in conjunction with the gdbm dbm implementation.
Establish a read lock.
This operation is called before a key is read. By default the function does nothing.
Establish a write lock.
This operation is called before a key is written. A return value of True indicates the lock has been acquired.
By default the function returns True unconditionally.
‘replace’ is a hint indicating the full contents of the namespace may be safely discarded. Some backends may implement this (i.e. file backend won’t unpickle the current contents).
Implement removal of the entire contents of this NamespaceManager.
e.g. for a file-based namespace, this would remove all the files.
The front-end to this method is the NamespaceManager.remove() method.
Return a locking object that is used to synchronize multiple threads or processes which wish to generate a new cache value.
This function is typically an instance of FileSynchronizer, ConditionSynchronizer, or null_synchronizer.
The creation lock is only used when a requested value does not exist, or has been expired, and is only used by the Value key-management object in conjunction with a “createfunc” value-creation function.
Return True if the given key is present in this Namespace.
Return the list of all keys.
This method may not be supported by all NamespaceManager implementations.
Release a read lock.
This operation is called after a key is read. By default the function does nothing.
Release a write lock.
This operation is called after a new value is written. By default this function does nothing.
Remove the entire contents of this NamespaceManager.
e.g. for a file-based namespace, this would remove all the files.
Sets a value in this NamespaceManager.
This is the same as __setitem__(), but also allows an expiration time to be passed at the same time.
Bases: beaker.container.NamespaceManager
A NamespaceManager where read/write operations require opening/ closing of a resource which is possibly mutexed.
Implements synchronization, expiration, and value-creation logic for a single value stored in a NamespaceManager.
return true if the container has a value stored.
This is regardless of it being expired or not.
Implements synchronization and value-creation logic for a ‘value’ stored in a NamespaceManager.
Container and its subclasses are deprecated. The Value class is now used for this purpose.
Bases: type
Bases: beaker.container.Container
Bases: beaker.container.Container
Bases: beaker.container.Container