Package django :: Package core :: Package cache :: Package backends :: Module base :: Class BaseCache
[hide private]
[frames] | no frames]

Class BaseCache

source code

object --+
         |
        BaseCache

Instance Methods [hide private]
 
__init__(self, params)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
add(self, key, value, timeout=None)
Set a value in the cache if the key does not already exist.
source code
 
get(self, key, default=None)
Fetch a given key from the cache.
source code
 
set(self, key, value, timeout=None)
Set a value in the cache.
source code
 
delete(self, key)
Delete a key from the cache, failing silently.
source code
 
get_many(self, keys)
Fetch a bunch of keys from the cache.
source code
 
has_key(self, key)
Returns True if the key is in the cache and has not expired.
source code
 
__contains__(self, key)
Returns True if the key is in the cache and has not expired.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, params)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

add(self, key, value, timeout=None)

source code 

Set a value in the cache if the key does not already exist. If timeout is given, that timeout will be used for the key; otherwise the default cache timeout will be used.

get(self, key, default=None)

source code 

Fetch a given key from the cache. If the key does not exist, return default, which itself defaults to None.

set(self, key, value, timeout=None)

source code 

Set a value in the cache. If timeout is given, that timeout will be used for the key; otherwise the default cache timeout will be used.

get_many(self, keys)

source code 

Fetch a bunch of keys from the cache. For certain backends (memcached, pgsql) this can be *much* faster when fetching multiple values.

Returns a dict mapping each key in keys to its value. If the given key is missing, it will be missing from the response dict.