LRUCache
Index
Methods
__delitem__
Remove an item from the cache.
Parameters
optionalkeyword-onlykey: str
Returns None
__getitem__
Get an item from the cache. Move it to the end if present.
Parameters
optionalkeyword-onlykey: str
Returns T
__init__
A default constructor.
Parameters
optionalkeyword-onlymax_length: int
The maximum number of items to store in the cache.
Returns None
__iter__
Iterate over the keys of the cache in order of insertion.
Returns Iterator[str]
__len__
Get the number of items in the cache.
Returns int
__setitem__
Add an item to the cache. Remove least used item if max_length exceeded.
Parameters
optionalkeyword-onlykey: str
optionalkeyword-onlyvalue: T
Returns None
items
Iterate over the pairs of (key, value) in the cache in order of insertion.
Returns ItemsView[str, T]
values
Iterate over the values in the cache in order of insertion.
Returns ValuesView[T]
Attempt to reimplement LRUCache from
@apify/datastructures
usingOrderedDict
.