Package gluon :: Module cache
[hide private]
[frames] | no frames]

Module cache

source code


| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Basic caching classes and methods
---------------------------------

- Cache - The generic caching object interfacing with the others
- CacheInRam - providing caching in ram
- CacheOnDisk - provides caches on disk

Memcache is also available via a different module (see gluon.contrib.memcache)

When web2py is running on Google App Engine,
caching will be provided by the GAE memcache
(see gluon.contrib.gae_memcache)

Classes [hide private]
  Cache
Sets up generic caching, creating an instance of both CacheInRam and CacheOnDisk.
  CacheAbstract
Abstract class for cache implementations.
  CacheAction
  CacheInRam
Ram based caching
  CacheOnDisk
Disk based cache
Functions [hide private]
 
lazy_cache(key=None, time_expire=None, cache_model='ram')
Can be used to cache any function including ones in modules, as long as the cached function is only called within a web2py request
source code
Variables [hide private]
  DEFAULT_TIME_EXPIRE = 300
  __package__ = 'gluon'
  have_settings = True
  logger = <logging.Logger object at 0x2a16550>
Function Details [hide private]

lazy_cache(key=None, time_expire=None, cache_model='ram')

source code 

Can be used to cache any function including ones in modules, as long as the cached function is only called within a web2py request

If a key is not provided, one is generated from the function name `time_expire` defaults to None (no cache expiration)

If cache_model is "ram" then the model is current.cache.ram, etc.