Skip to main content

A simple key-value caching API with default implementations for an SQLite3 storage backend and a JSON convenience layer.

Project description

Note: This package is in the dangerous land of 0.x.y versions and may be subject to breaking changes with minor version increments.

nr.caching

A simple key-value caching API with default implementations for an SQLite3 storage backend and a JSON convenience layer.

Quickstart

from nr.caching.sqlite import SqliteStore
from nr.caching.json import hash_args, JsonCacheFactory

caching_backend = SqliteStore('.cache.db')
cache_factory = JsonCacheFactory(caching_backend, default_exp=60)
data = cache_factory.namespace('my-namespace').loading(
  f'expensive_function_{hash_args(parameters)}',
  lambda: expensive_function(*parameters))

Copyright © 2021 Niklas Rosenstein

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

nr.caching-0.3.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

nr.caching-0.3.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file nr.caching-0.3.0.tar.gz.

File metadata

  • Download URL: nr.caching-0.3.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for nr.caching-0.3.0.tar.gz
Algorithm Hash digest
SHA256 50e7a8385352b1cc8a15667d71f916beffffc4590363348dd1ae68133b4c135a
MD5 61d71461e6471a8d771684163ee99d67
BLAKE2b-256 3e5b99bec629187d7bc6433e1924b02c67d9bae672c0f127d256a2cbd458152c

See more details on using hashes here.

File details

Details for the file nr.caching-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: nr.caching-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for nr.caching-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 379dd86047a22afe3c6cad1331763f8557f9dae34702cd980969e3aa557106e9
MD5 49b98ad2954bae93c209dd9c23313ff0
BLAKE2b-256 fe61d19fe15f3de7c8e04849ed2e0284629002ac209fa79ecdbe8413c63b8a08

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