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.4.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ncache-0.4-py2.py3-none-any.whl (15.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: ncache-0.4.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ncache-0.4.tar.gz
Algorithm Hash digest
SHA256 e9cec3de4eee9cd8b3f8a3999bffe6c144d69d32f1ba8faa236c2b25a92be3c5
MD5 49d962a4969289b191adfd3ef0155c6e
BLAKE2b-256 d2448694e2e65bea729066413ad5cd32a3d8581d40c6529dda7c4313e5225f15

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ncache-0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ncache-0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bda5b781bd55d225efa65623bd8eaf43cc3132b00af5bcdb3946929c8db70cc5
MD5 80f9ea0d01660b27fd7f4cda01f5a6b3
BLAKE2b-256 735f5f1497c7fd87acd4c4c0614ff1bfb7abf3cbf81cf63f1b40a816e12a153f

See more details on using hashes here.

Supported by

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