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

Class MemcacheWrapper

source code

object --+
         |
        MemcacheWrapper

Memcache wrapper, applying default max age

This is, what the decorator injects if a default max age is configured or the exceptions are caught.

Instance Methods [hide private]
 
__init__(self, mcc, max_age, exceptions)
Initialization
source code
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

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

Instance Variables [hide private]
int _max_age
Default max age
Memcache _mc
Memcache connector
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, mcc, max_age, exceptions)
(Constructor)

source code 
Initialization
Parameters:
  • mcc (Memcache) - Memcache connector
  • max_age (int) - Default expire time
  • exceptions (bool) - pass exceptions to the caller?
Overrides: object.__init__

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?