This repository was archived by the owner on Jan 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Make cache LRU #105
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Caching in DataSources (as enabled with an ‘expires’ value other than 0), can be made more fit for purpose by following the Last Recently Used principle instead of, currently, Last Recently Added. That way, the items that are requested more frequently tend to stay in the cache longer. Currently, if an item has been added a longer time ago, it will be removed if enough new items have been added to push it out of the cache FIFO.
This should be trivial to achieve using OrderDict’s move_to_end method in the OrderedDict subclass’ getitem to move the last requested item to the “last added” (end) position of the dict.
However, care must be taken to test this properly and differentiate it from the previous FIFO style in the unit tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request