:mod:`humphrey.core.cache` ========================== .. moduleauthor:: H. Turgut Uyar .. moduleauthor:: Davide Alberani .. currentmodule:: humphrey.core.cache .. automodule:: humphrey.core.cache The cache is either a regular dictionary or a file as handled by the `anydbm`_ module. If you would like to use such a file-based cache, you can specify the file name when initializing the cache:: c = Cache(os.path.expanduser('~/.humphrey.cache')) There is an expiration time on the stored items (default is 1 hour). This can be specified (in seconds) at initialization. For example, to create a cache with a 1 minute expiration time:: c = Cache(expires=60) Every item is stored along with a timestamp, which will be updated whenever the item is accessed. If you want to access an item without updating its timestamp, use:: item = c.get(key, default, update=False) .. _anydbm: http://docs.python.org/library/anydbm.html API --- .. autoclass:: Cache :members: