objcache.models package

Submodules

objcache.models.object_cache module

exception objcache.models.object_cache.CantLoadCollectionException[source]

Bases: Exception

class objcache.models.object_cache.ObjectCache(db_path, cache_path)[source]

Bases: object

Store Python objects on the filesystem and load them later. Built on top of ZoDB but provides an easier to use interface.

Examples
>>> from objcache import ObjectCache
>>> cache = ObjectCache('cache.zodb', ('a', 'b'))
>>> cache.store(5)
>>> # Later session
>>> cache = ObjectCache('cache.zodb', ('a', 'b'))
>>> result = cache.get()
>>> print(result)
5
__init__(db_path, cache_path)[source]

Initialize self. See help(type(self)) for accurate signature.

property db
property db_root
delete()[source]

Delete previously stored Python object from the filesystem

Return type

None

exists()[source]

Check whether there is already a Python object stored on the filesystem for this cache path

Return type

bool

get()[source]

Get Python object from the filesystem

Return type

Any

store(result)[source]

Store Python object on the filesystem

Return type

None