cache
— Utilities for implementing caches¶
New in version 0.9: This module was added in version 0.9.
-
class
aioxmpp.cache.
LRUDict
(**kwargs)[source]¶ Size-restricted dictionary with Least Recently Used expiry policy.
New in version 0.9.
The
LRUDict
supports normal dictionary-style access and implementscollections.abc.MutableMapping
.When the
maxsize
is exceeded, as many entries as needed to get below themaxsize
are removed from the dict. Least recently used entries are purged first. Setting an entry does not count as use!-
maxsize
¶ Maximum size of the cache. Changing this property purges overhanging entries immediately.
If set to
None
, no limit on the number of entries is imposed. Do not use a limit ofNone
for data where the key is under control of a remote entity.Use cases for
None
are those where you only need the explicit expiry feature, but not the LRU feature.
-