Documentation

Examples

Caching

Basic Example:

from beaker.cache import CacheManager
cm = CacheManager(type='dbm', data_dir='./cache')
cache = cm.get_cache('mytemplate')
def somethingslow():
# slow stuff
db_lookups()
# Get the value, this will create the cache copy the first time
# and any time it expires (in seconds, so 3600 = one hour)
result = mycache.get_value(day, createfunc=somethingslow, expiretime=3600)