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

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file ncache-0.3.tar.gz.

File metadata

  • Download URL: ncache-0.3.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.0.0 pkginfo/1.7.1 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.65.0 CPython/3.8.11

File hashes

Hashes for ncache-0.3.tar.gz
Algorithm Hash digest
SHA256 a17d83b7a80d3d29376836a44b4708c5eadedc09e042457bceef269ce74c6718
MD5 fddf4e763fb69eb6f7a5d4720baec18f
BLAKE2b-256 9b43740252461bed1f1680045ee780afbd597f1c18c8843f3507d5f7f26322d1

See more details on using hashes here.

File details

Details for the file ncache-0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: ncache-0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.0.0 pkginfo/1.7.1 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.65.0 CPython/3.8.11

File hashes

Hashes for ncache-0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 71df85ac1dc1068accc9bb94ef027887c326a8a157c5592a80961a639e8dd596
MD5 004edd25e8c296f7638be5d6893a85a7
BLAKE2b-256 06ce2a24a91558af3d19baa69d98ae97398b6e5207906b47eafbf2ee6d9d79dc

See more details on using hashes here.

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