Package wtf :: Package app :: Package services :: Module memcache :: Class NoMemcacheWrapper
[hide private]
[frames] | no frames]

Class NoMemcacheWrapper

source code

object --+
         |
        NoMemcacheWrapper

Dummy connector, which does nothing actually, but provide the API
Instance Methods [hide private]
bool
set(self, key, value, max_age=None)
Set a key/value pair unconditionally
source code
bool
add(self, key, value, max_age=None)
Set a key/value pair if the key does not exist yet
source code
bool
replace(self, key, value, max_age=None)
Set a key/value pair only if the key does exist already
source code
bool
delete(self, key, block_time=None, all_pools=False)
Delete a key/value pair from the cache
source code
dict
get(self, *keys)
Get a list of key/value pairs from the cache (if applicable)
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 
Set a key/value pair unconditionally
Parameters:
  • key (str) - The key to store under
  • value (any) - The value to store (should be picklable)
  • max_age (int) - Maximum age in seconds. If omitted or None the default is applied.
Returns: bool
Stored successfully?

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

source code 
Set a key/value pair if the key does not exist yet
Parameters:
  • key (str) - The key to store under
  • value (any) - The value to store (should be picklable)
  • max_age (int) - Maximum age in seconds. If omitted or None the default is applied.
Returns: bool
Stored successfully?

replace(self, key, value, max_age=None)

source code 
Set a key/value pair only if the key does exist already
Parameters:
  • key (str) - The key to store under
  • value (any) - The value to store (should be picklable)
  • max_age (int) - Maximum age in seconds. If omitted or None the default is applied.
Returns: bool
Stored successfully?

delete(self, key, block_time=None, all_pools=False)

source code 
Delete a key/value pair from the cache
Parameters:
  • key (str) - The key to identify the item to delete
  • block_time (int) - Time to block add and replace requests for this key in seconds. If omitted or None, the blocking time is 0.
  • all_pools (bool) - Issue delete to each pool? This may be useful to enforce the deletion on backup pools, too. However, it won't delete the key from currently dead pools. So, it might be not that useful after all, but it's the best we can do from this side of the ocean.
Returns: bool
Whether it was really deleted from the main pool (or the current backup pool) of this key (i.e. whether it existed before)

get(self, *keys)

source code 

Get a list of key/value pairs from the cache (if applicable)

The returned dict contains all pairs it could get. But keys maybe missing or the dict might be completely empty (of course).

Parameters:
  • keys (tuple) - The keys to fetch
Returns: dict
The dict of key/value pairs