Skip to main content

firm-cache

Database-backed caching for Python — a pure-Python port of Rails' Solid Cache. No Redis required: cache entries live in your existing SQLite, PostgreSQL, or MySQL/MariaDB database.

Part of firm, a port of the Rails 8 Solid stack.

pip install firm-cache
pip install "firm-cache[encryption]"  # with at-rest encryption

Quickstart

from firm.cache import Cache

cache = Cache(database_url="postgresql://localhost/myapp")

cache.set("greeting", "hello")
cache.get("greeting")  # "hello"
cache.fetch("expensive", lambda: compute())  # compute once, then cached

Highlights

  • FIFO eviction by age, total size, or entry count — tuned in the background, like Solid Cache
  • Cache anything you can serialize — JSON by default; raw bytes (thumbnails, protobuf, compressed blobs) and ~⅓ smaller rows with firm-cache[msgpack]; arbitrary Python objects with the opt-in pickle coder
  • At-rest encryption (Fernet) via firm-cache[encryption]
  • fetch, get_multi/set_multi, increment/decrement

Docs

MIT licensed. Schema and design derived from Solid Cache (© 37signals, MIT); see NOTICE.

Metadata

Release files for firm-cache 1.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 firm-cache 1.1.0
File Size Uploaded
firm_cache-1.1.0.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for firm-cache 1.1.0
File Interpreter ABI Platform
firm_cache-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.2 kB

Release files / firm_cache-1.1.0.tar.gz

Download URL firm_cache-1.1.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c3411c46498049574946aa209984b9cf55cd4df38b054b4504f82c022a796f03
BLAKE2b-256 checksum
How to use checksums
dcb5c2843e4c999f72a13419acbc58b849658897fb59fc556e1bf3e81e5c58fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / firm_cache-1.1.0-py3-none-any.whl

Download URL firm_cache-1.1.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a78f5bd860c2eb1237b498bb68111660bcebce6c2d2669d7d3f1846c0e5ac9cc
BLAKE2b-256 checksum
How to use checksums
e958019ab79f645582ce758bcabead2b6c32d7d57586af180c026d40ddf7faa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

0.1.0

2 release files

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