Package flumotion :: Package twisted :: Module flavors :: Class StateCacheable
[hide private]

Class StateCacheable

source code

 twisted.spread.jelly.Jellyable --+            
                                  |            
twisted.spread.flavors.Serializable --+        
                                      |        
        twisted.spread.flavors.Copyable --+    
                                          |    
           twisted.spread.flavors.Cacheable --+
                                              |
                                             StateCacheable
Known Subclasses:

I am a cacheable state object.

I cache key-value pairs, where values can be either single objects or list of objects.

Instance Methods [hide private]
 
__init__(self) source code
 
addKey(self, key, value=None)
Add a key to the state cache so it can be used with set.
source code
 
addListKey(self, key, value=None)
Add a key for a list of objects to the state cache.
source code
 
addDictKey(self, key, value=None)
Add a key for a dict value to the state cache.
source code
 
hasKey(self, key) source code
 
keys(self) source code
 
get(self, key, otherwise=None)
Get the state cache value for the given key.
source code
 
set(self, key, value)
Set a given state key to the given value.
source code
 
append(self, key, value)
Append the given object to the given list.
source code
 
remove(self, key, value)
Remove the given object from the given list.
source code
 
setitem(self, key, subkey, value)
Set a value in the given dict.
source code
 
delitem(self, key, subkey)
Removes an element from the given dict.
source code
 
getStateToCacheAndObserveFor(self, perspective, observer)
Get state to cache on the client and client-cache reference to observe locally.
source code
 
stoppedObserving(self, perspective, observer)
This method is called when a client has stopped observing me.
source code

Inherited from twisted.spread.flavors.Cacheable: jellyFor

Inherited from twisted.spread.flavors.Copyable: getStateToCopy, getStateToCopyFor, getTypeToCopy, getTypeToCopyFor

Inherited from twisted.spread.flavors.Serializable: processUniqueID

Inherited from twisted.spread.jelly.Jellyable: __providedBy__, getStateFor

Class Variables [hide private]

Inherited from twisted.spread.flavors.Copyable: __implemented__, __provides__

Method Details [hide private]

get(self, key, otherwise=None)

source code 

Get the state cache value for the given key.

Return otherwise in case where key is present but value None.

set(self, key, value)

source code 

Set a given state key to the given value. Notifies observers of this Cacheable through observe_set.

append(self, key, value)

source code 

Append the given object to the given list. Notifies observers of this Cacheable through observe_append.

remove(self, key, value)

source code 

Remove the given object from the given list. Notifies observers of this Cacheable through observe_remove.

setitem(self, key, subkey, value)

source code 

Set a value in the given dict. Notifies observers of this Cacheable through observe_setitem.

delitem(self, key, subkey)

source code 

Removes an element from the given dict. Note that the key refers to the dict; it is the subkey (and its value) that will be removed. Notifies observers of this Cacheable through observe_delitem.

getStateToCacheAndObserveFor(self, perspective, observer)

source code 

Get state to cache on the client and client-cache reference to observe locally.

This is similiar to getStateToCopyFor, but it additionally passes in a reference to the client-side RemoteCache instance that will be created when it is unserialized. This allows Cacheable instances to keep their RemoteCaches up to date when they change, such that no changes can occur between the point at which the state is initially copied and the client receives it that are not propogated.

Overrides: twisted.spread.flavors.Cacheable.getStateToCacheAndObserveFor
(inherited documentation)

stoppedObserving(self, perspective, observer)

source code 

This method is called when a client has stopped observing me.

The 'observer' argument is the same as that passed in to getStateToCacheAndObserveFor.

Overrides: twisted.spread.flavors.Cacheable.stoppedObserving
(inherited documentation)