Dict
LeastRecentlyUsedDict
¶
Bases: OrderedDict[Hashable, int]
A dict with a maximum size, evicting the least recently written key when full.
Getting a key that is not present returns a default value of 0.
Setting a key marks it as most recently used and removes the oldest key if full.
May be useful for tracking the count of items where limited memory usage is needed even if the set of items can be unlimited.
Based on the example at https://docs.python.org/3/library/collections.html#ordereddict-examples-and-recipes
Source code in nava/platform/util/collections/dict.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
from_str_values(value)
¶
Convert a sequence of 'key=value' strings into a dictionary.
Source code in nava/platform/util/collections/dict.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|