Skip to content

acmerfight/lru_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lru cahe

Thread-safe lru cache decorator based on double link list and dictOrderedDict

how to install

pip install lru_cache

how to use

from cache import LruCache

# maxsize the max number of cache object
# timeout the max time(second) cache object stay
@LruCache(maxsize=2, timeout=1)
def foo(num):
    return num

# invalidate cache
foo.invalidate(num)

hint

  • timeout is not updated in real time

  • LruCache doesn't support unhashable obejct

About

lru_cache

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages