Skip to main content

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

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncache-0.3.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

ncache-0.3-py2.py3-none-any.whl (15.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page