Skip to main content

python-flowmaticcache

A small cache abstraction for Python, with pluggable backends: Redis, Valkey, Memcached, flowmaticdb and an in-process shared-memory store.

Install

pip install flowmaticcache                 # shared_memory works out of the box
pip install "flowmaticcache[redis]"        # Redis
pip install "flowmaticcache[valkey]"       # Valkey
pip install "flowmaticcache[memcached]"    # Memcached
pip install "flowmaticcache[flowmaticdb]"  # flowmaticdb-backed cache table
pip install "flowmaticcache[all]"          # every backend
pip install "flowmaticcache[dev]"          # pytest, mypy, ruff + all backends

Usage

from flowmaticcache import Cache

cache = Cache.shared_memory()
# cache = Cache.connect_redis(host="localhost", port=6379)
# cache = Cache.connect_valkey(host="localhost", port=6380)
# cache = Cache.connect_memcached(host="localhost", port=11211)
# cache = Cache.connect_flowmaticdb(db, table="cache")

cache.set("key", {"any": "picklable value"}, ttl=60)  # ttl in seconds, optional
cache.get("key")
cache.exists("key")
cache.delete("key")
cache.clear()

cache.add("key", "value", ttl=60)          # only sets if not already present, returns bool
cache.pull("key", default=None)            # get then delete
cache.remember("key", lambda: expensive(), ttl=60)  # get, or compute + store if missing/expired

Testing

Redis, Valkey and Memcached tests run against local containers:

docker compose up -d
pip install -e ".[dev]"
pytest

Database-backed tests use flowmaticdb's in-memory SQLite adapter, so no external service is required for those.

Publishing

./build-and-publish.sh

Reads PYPI_API_KEY from .env (see .env.example), builds the package and uploads it to PyPI after confirmation.

Release files for flowmaticcache 1.0.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 flowmaticcache 1.0.0
File Size Uploaded
flowmaticcache-1.0.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flowmaticcache 1.0.0
File Interpreter ABI Platform
flowmaticcache-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / flowmaticcache-1.0.0.tar.gz

Download URL flowmaticcache-1.0.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c088e907850aa53ae21b93b86397a87bdbd168b88533a1813715ddee259ba9bc
BLAKE2b-256 checksum
How to use checksums
5e3a0e07f8419e19a343a6b8c847f1edb4c498a6010b03a48d56df3f82fe140a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / flowmaticcache-1.0.0-py3-none-any.whl

Download URL flowmaticcache-1.0.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac92ef0f7abaa6d142bec026907f93cf58ccd4596cd23c04fb3053ef97d3e931
BLAKE2b-256 checksum
How to use checksums
44ff02599bbcf6b321e2a74f00474e8523992baf6af144fe2b629f09f3451279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

1.0.1

2 release files

This release

1.0.0 This release

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