Package flickrapi :: Module cache :: Class SimpleCache
[hide private]
[frames] | no frames]

Class SimpleCache

source code

object --+
         |
        SimpleCache

Simple response cache for FlickrAPI calls.

This stores max 50 entries, timing them out after 120 seconds: >>> cache = SimpleCache(timeout=120, max_entries=50)

Instance Methods [hide private]
 
__init__(self, timeout=300, max_entries=200)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
locking(method)
Method decorator, ensures the method call is locked
source code
 
get(self, *args, **kwargs)
Fetch a given key from the cache.
source code
 
set(self, *args, **kwargs)
Set a value in the cache.
source code
 
delete(self, *args, **kwargs)
Deletes a key from the cache, failing silently if it doesn't exist.
source code
 
has_key(self, *args, **kwargs)
Returns True if the key is in the cache and has not expired.
source code
 
__contains__(self, *args, **kwargs)
Returns True if the key is in the cache and has not expired.
source code
 
cull(self, *args, **kwargs)
Reduces the number of cached items
source code
 
__len__(self, *args, **kwargs)
Returns the number of cached items -- they might be expired though.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, timeout=300, max_entries=200)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

get(self, *args, **kwargs)

source code 
Fetch a given key from the cache. If the key does not exist, return default, which itself defaults to None.
Decorators:
  • @locking

set(self, *args, **kwargs)

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.
Decorators:
  • @locking

delete(self, *args, **kwargs)

source code 
Deletes a key from the cache, failing silently if it doesn't exist.
Decorators:
  • @locking

has_key(self, *args, **kwargs)

source code 
Returns True if the key is in the cache and has not expired.
Decorators:
  • @locking

__contains__(self, *args, **kwargs)
(In operator)

source code 
Returns True if the key is in the cache and has not expired.
Decorators:
  • @locking

cull(self, *args, **kwargs)

source code 
Reduces the number of cached items
Decorators:
  • @locking

__len__(self, *args, **kwargs)
(Length operator)

source code 
Returns the number of cached items -- they might be expired though.
Decorators:
  • @locking