A decorator for "getter" functions that fetch an object from
the database based on a single key. The wrapped method will only be
called if the named cache does not contain the key.
The wrapped function must take one argument (the key); the wrapper
will take a key plus an optional no_cache argument which, if
true, will cause it to invoke the underlying method even if the key is in
the cache.
The resulting method will have a cache attribute which
can be used to access the underlying cache.
- Parameters:
cache_name - name of the cache to use
|