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 API with implementations for local JSON and SQLite3 storage backends and a JSON convenience layer.

Quickstart

from nr.caching.stores.sqlite import SqliteStore
from nr.caching.adapters.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.4.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

nr.caching-0.4.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nr.caching-0.4.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for nr.caching-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a109b3fb5c184c135e336f37000bde7f8de890714cf8b57f7de17a65fdd43c2c
MD5 09c9ed5ccd5877689d6459d0c72adebf
BLAKE2b-256 bdb3cfd7e54c39de0db8251b1ac1fffd4487b2d0753e7e11091b4cf7ca3339ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nr.caching-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for nr.caching-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fe483c6fd7695c4d2d6284fb9f4d432f0c3e5ed0e02e2df31e72c7cb0748e1d
MD5 34981fa5ca41f1aac02d787e327eab5e
BLAKE2b-256 52539dfb156911d4e74fa6b0bcf5f2b2538e835423ec91c6b09e1477f5b32fee

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