Package conary :: Package lib :: Module util :: Class ObjectCache
[hide private]
[frames] | no frames]

Class ObjectCache

source code

object --+    
         |    
      dict --+
             |
            ObjectCache

Implements a cache of arbitrary (hashable) objects where an object can be looked up and have its cached value retrieved. This allows a single copy of immutable objects to be kept in memory.

Instance Methods [hide private]
 
__init__(self, *args)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__setitem__(self, key, value)
x[i]=y
source code
 
__contains__(self, key)
Returns: True if D has a key k, else False
source code
 
has_key(self, key)
Returns: True if D has a key k, else False
source code
 
__delitem__(self, key)
del x[y]
source code
 
__getitem__(self, key)
x[y]
source code
 
setdefault(self, key, value)
Returns: D.get(k,d), also set D[k]=d if k not in D
source code

Inherited from dict: __cmp__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, clear, copy, fromkeys, get, items, iteritems, iterkeys, itervalues, keys, pop, popitem, update, values

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Returns:
new empty dictionary

Overrides: dict.__init__
(inherited documentation)

__setitem__(self, key, value)
(Index assignment operator)

source code 
x[i]=y
Overrides: dict.__setitem__
(inherited documentation)

__contains__(self, key)
(In operator)

source code 
Returns:
True if D has a key k, else False

Overrides: dict.__contains__
(inherited documentation)

has_key(self, key)

source code 
Returns:
True if D has a key k, else False

Overrides: dict.has_key
(inherited documentation)

__delitem__(self, key)
(Index deletion operator)

source code 
del x[y]
Overrides: dict.__delitem__
(inherited documentation)

__getitem__(self, key)
(Indexing operator)

source code 
x[y]
Overrides: dict.__getitem__
(inherited documentation)

setdefault(self, key, value)

source code 
Returns:
D.get(k,d), also set D[k]=d if k not in D

Overrides: dict.setdefault
(inherited documentation)