| | |
- WeakKeyDictionary(WeakKeyDictionary)
-
- Cache
- object
-
- CacheHolder
class Cache(WeakKeyDictionary) |
| |
Trivial sub-class of the WeakKeyDictionary
Maps client: {
key="": CacheHolder()
}
That is, for each client node, a dictionary
holds opaque key(normally strings) to CacheHolder
instances. The CacheHolder is responsible for
most of the implementation of the cache. |
| |
- Method resolution order:
- Cache
- WeakKeyDictionary
- WeakKeyDictionary
- UserDict
Methods defined here:
- getData(self, client, key='', default=None)
- Return the data for given client and key, default otherwise
- getHolder(self, client, key='')
- Return the cache holder for the given client and key
- holder(self, client, data, key='')
- Create a new CacheHolder in this cache
Data and non-method functions defined here:
- __doc__ = 'Trivial sub-class of the WeakKeyDictionary\n\n\tMap...e for\n\tmost of the implementation of the cache.\n\t'
- __module__ = 'OpenGLContext.scenegraph.cache'
Methods inherited from WeakKeyDictionary:
- __delitem__(self, key)
- __init__(self, dict=None)
Methods inherited from WeakKeyDictionary:
- __getitem__(self, key)
- __iter__ = iterkeys(self)
- __repr__(self)
- __setitem__(self, key, value)
- copy(self)
- get(self, key, default=None)
- has_key(self, key)
- items(self)
- iteritems(self)
- iterkeys(self)
- itervalues(self)
- keys(self)
- popitem(self)
- setdefault(self, key, default)
- update(self, dict)
Methods inherited from UserDict:
- __cmp__(self, dict)
- __contains__(self, key)
- __len__(self)
- clear(self)
- values(self)
|
class CacheHolder(object) |
| |
Holder for data values within a cache
The CacheHolder provides the bulk of the cache
implementation. It associates an opaque data value
with a client node and an opaque key. The key
value allows multiple dimensions of storage, to
allow, for instance storing compiled shadow
information separate from compiled geometry
information.
The depend method uses the dispatcher module
to invalidate this CacheHolder when the given
fields for the given nodes are changed.
Attributes:
client -- weak reference to the client node
key -- strong reference to the opaque key value
data -- strong reference to the opaque data value
cache -- weak reference to the cache in which
we are storing ourselves |
| |
Methods defined here:
- __call__(self, signal=None, sender=None)
- Delete the cached value (this object)
This de-registers ourselves from our cache object,
with suitable checks for whether our cache is still
alive itself, and whether it still has an entry
for our client and our key.
If this is the last registered cache object
for our client, deletes the overall cache dictionary
for the client.
- __init__(self, client, data, key='', cache=<WeakKeyDictionary at 91195184>)
- Initialise the cache-deletion callable
client -- the node doing the caching, if gc'd,
then the entire cache for the node is deleted
key -- opaque key into the cache's per-node storage
cache -- the particular cache in which to store
ourselves.
- depend(self, node, field=None)
- Add a dependency on given node's field value
source -- the node being watched
field -- the field on the node being watched
Dependency on the node means that this cache
holder will be invalidated if the field value
changes. This does not create a dependency
on the existence of node, so you should set
the dependency for the field holding any
nodes which should invalidate this CacheHolder
Note:
This does not affect any other CacheHolder
for our client node.
Data and non-method functions defined here:
- __doc__ = 'Holder for data values within a cache\n\n\tThe Cach... the cache in which\n\t\t\twe are storing ourselves\n\t'
- __getstate__ = <built-in function __getstate__>
- __module__ = 'OpenGLContext.scenegraph.cache'
- __slots__ = ('client', 'data', 'key', 'cache', 'nodeDependencies', '__weakref__')
- __weakref__ = <member '__weakref__' of 'CacheHolder' objects>
- cache = <member 'cache' of 'CacheHolder' objects>
- client = <member 'client' of 'CacheHolder' objects>
- data = <member 'data' of 'CacheHolder' objects>
- key = <member 'key' of 'CacheHolder' objects>
- nodeDependencies = <member 'nodeDependencies' of 'CacheHolder' objects>
Methods inherited from object:
- __delattr__(...)
- x.__delattr__('name') <==> del x.name
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __hash__(...)
- x.__hash__() <==> hash(x)
- __reduce__(...)
- helper for pickle
- __repr__(...)
- x.__repr__() <==> repr(x)
- __setattr__(...)
- x.__setattr__('name', value) <==> x.name = value
- __str__(...)
- x.__str__() <==> str(x)
Data and non-method functions inherited from object:
- __class__ = <type 'type'>
- __new__ = <built-in method __new__ of type object at 0x1E0BD978>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
| |