Package ganeti :: Module cache :: Class CacheBase
[hide private]
[frames] | no frames]

Class CacheBase

source code

This is the base class for all caches.

Instance Methods [hide private]
 
__init__(self)
Base init method.
source code
 
Store(self, key, value, ttl=0)
Stores key with value in the cache.
source code
 
GetMulti(self, keys)
Retrieve multiple values from the cache.
source code
 
Get(self, key)
Retrieve the value from the cache.
source code
 
Invalidate(self, keys)
Invalidate given keys.
source code
 
Flush(self)
Invalidates all of the keys and flushes the cache.
source code
 
ResetState(self)
Used to reset the state of the cache.
source code
 
Cleanup(self)
Cleanup the cache from expired entries.
source code
Method Details [hide private]

Store(self, key, value, ttl=0)

source code 

Stores key with value in the cache.

Parameters:
  • key - The key to associate this cached value
  • value - The value to cache
  • ttl - TTL in seconds after when this entry is considered outdated
Returns:
True on success, False on failure

GetMulti(self, keys)

source code 

Retrieve multiple values from the cache.

Parameters:
  • keys - The keys to retrieve
Returns:
The list of values

Get(self, key)

source code 

Retrieve the value from the cache.

Parameters:
  • key - The key to retrieve
Returns:
The value or None if not found

Invalidate(self, keys)

source code 

Invalidate given keys.

Parameters:
  • keys - The list of keys to invalidate
Returns:
True on success, False otherwise

ResetState(self)

source code 

Used to reset the state of the cache.

This can be used to reinstantiate connection or any other state refresh