Skip to main content

dd-cache

Backend-swappable caching layer for the dd-* ecosystem.

Install

pip install -e .           # core (memory + disk)
pip install -e ".[redis]"  # add Redis support
pip install -e ".[dev]"    # + pytest

Quick start

from dd_cache import InMemoryCache, DiskCache

# In-process, TTL-aware
with InMemoryCache() as cache:
    cache.set("key", {"data": 42}, ttl=60)
    value = cache.get("key")

# Persistent SQLite
with DiskCache(".cache/myapp.db") as cache:
    result = cache.get_or_set("expensive_key", lambda: run_expensive_query())

Adapters

Class Backend Persistence TTL Extra deps
InMemoryCache dict process lazy none
DiskCache SQLite file lazy none
RedisCache Redis server native redis

API

cache.get(key)                    # → Any | None
cache.set(key, value, ttl=None)   # ttl in seconds
cache.delete(key)                 # → bool
cache.exists(key)                 # → bool
cache.clear()
cache.stats()                     # → CacheStats
cache.get_or_set(key, fn, ttl=None)

See docs/DESIGN.md for architecture details.

Metadata

Release files for dd-cache 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dd-cache 0.1.0
File Size Uploaded Provenance Actions
dd_cache-0.1.0.tar.gz 7.5 kB Without provenance Details for dd_cache-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dd-cache 0.1.0
File Interpreter ABI Platform Actions
dd_cache-0.1.0-py3-none-any.whl Python 3 none any Details for dd_cache-0.1.0-py3-none-any.whl

Total release size: 15.3 kB

Release files / dd_cache-0.1.0.tar.gz

Download URL dd_cache-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
91691330dee2b082ebe95fe68aa0d019c9a218d47d9e7c0fe02204956da77da2
BLAKE2b-256 checksum
How to use checksums
aec5881ceea06b2efd2e421de4a7988e822d815bd826bde810e4968e1c13484d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / dd_cache-0.1.0-py3-none-any.whl

Download URL dd_cache-0.1.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ca745dbacc183662c1a2824272384beade70ffaaa3a5f5c4f792497f87f64db
BLAKE2b-256 checksum
How to use checksums
54021bf53a4c6d39443ace28ec74904888e3fd4517ef99603f2cbcf142ea77ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Security for dd-cache 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page