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
LRUDictsupports normal dictionary-style access and implementscollections.abc.MutableMapping.When the
maxsizeis exceeded, as many entries as needed to get below themaxsizeare 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 ofNonefor data where the key is under control of a remote entity.Use cases for
Noneare those where you only need the explicit expiry feature, but not the LRU feature.
-