Skip to content

rsusik/ncache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nano cache

Package version Package version

A simple and lightweight dictionary-based persistent cache for storing python objects.

Installation:

pip install ncache

Usage:

from ncache import Cache

cache = Cache('my.cache')
cache.load_cache()

values = []
try:
    _hash = cache.get_hash('key') 
    val = cache.get_value(_hash)  # raise NoCacheValue exception if not found
    values += [val]
    print('Value got from cache:', values)
except:
    # if not in cache then add it
    val = {'value'}
    cache.set_value(_hash, val)
    values += [val]
    print('Value added:', values)

cache.save_cache()

About

A simple and lightweight dictionary-based persistent cache for storing python objects.

Topics

Resources

License

Stars

Watchers

Forks

Languages