- Notifications
You must be signed in to change notification settings - Fork0
LRU caching with expiration period.
License
NotificationsYou must be signed in to change notification settings
datarootsio/expiring-lru-cache
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
expiring_lru_cache
is a minimal drop-in replacement offunctools.lru_cache
. Itallows the user to specify a time interval (in secs) after which the cache isinvalidated and reset.
Here an example cached function whose cache will invalidate after 10 seconds.
fromexpiring_lru_cacheimportlru_cache@lru_cache(expires_after=10)defmy_plus_one_func(x:int)->int:returnx+1
Here an example cached function whose cache will invalidate after 1 day. Note that theconvenience variablesMINUTES
,HOURS
andDAYS
are available within theexpiring_lru_cache
namespace.
fromexpiring_lru_cacheimportlru_cache,DAYS@lru_cache(expires_after=1*DAYS)defmy_plus_one_func(x:int)->int:returnx+1
About
LRU caching with expiration period.
Resources
License
Stars
Watchers
Forks
Packages0
No packages published