Package translate :: Package misc :: Module lru :: Class LRUCachingDict

[hide private]
[frames] | no frames]

# Class LRUCachingDict

source code

Caching dictionary like object that discards the least recently used objects when number of cached items exceeds maxsize.

cullsize is the fraction of items that will be discarded when maxsize is reached.

Instance Methods | [hide private]

__init__(self, maxsize, cullsize=2, *args, **kwargs) | source code

cull(self) free memory by deleting old items from cache | source code

__setitem__(self, key, value) | source code

__getitem__(self, key) | source code

__delitem__(self, key) | source code

clear(self) | source code

setdefault(self, key, default) | source code

Inherited from `weakref.WeakValueDictionary`: `__contains__`, `__iter__`, `__repr__`, `copy`, `get`, `has_key`, `items`, `iteritems`, `iterkeys`, `itervaluerefs`, `itervalues`, `pop`, `popitem`, `update`, `valuerefs`, `values` Inherited from `UserDict.UserDict`: `__cmp__`, `__len__`, `keys`

Class Methods | [hide private]

Inherited from `UserDict.UserDict`: `fromkeys`

Method Details | [hide private]

### __init__(self, maxsize, cullsize=2, *args, **kwargs)
(Constructor)

source code

Overrides: UserDict.UserDict.__init__

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

source code

Overrides: UserDict.UserDict.__setitem__

### __getitem__(self, key)
(Indexing operator)

source code

Overrides: UserDict.UserDict.__getitem__

### __delitem__(self, key)
(Index deletion operator)

source code

Overrides: UserDict.UserDict.__delitem__

### clear(self)

source code

Overrides: UserDict.UserDict.clear

### setdefault(self, key, default)

source code

Overrides: UserDict.UserDict.setdefault