Repository navigation
Releases
fastapi-cache-stable 0.5.0
Published to PyPI on 2026-11-21 from tag v0.5.0 (release commit 40c86d551b760315f3c6e99f383d6868c6294870).
- Wheel SHA-256:
7f30d074e222aaf4471d13105e1282b97d2968549bc4b727b941837272b10449 - Sdist SHA-256:
e5dfe2fb5a16cb790e98bfb5e57377d835adc55579b0fdf1cb1d0afbf610ba0b - TestPyPI workflow: 44852139879; production PyPI workflow: 44852386994.
- Highlights: opt-in
vary_headerswith versioned hashed keys and correct returned-ResponseVary/ETag/304 behavior; exact wheel/sdist migration and rollback evidence; authenticated pre-PyPI Dependabot gate. - Python 3.8–3.10 remain functional legacy only; security maintenance targets Python 3.11–3.13.
- The 21 historical Dependabot alerts remain open where applicable; see the release security record and the #66 decision.
See docs/releases/RELEASE_NOTES_0.5.0.md, MIGRATION.md, and docs/releases/RELEASE_CANDIDATE_0.5.0.md for limits and evidence.
fastapi-cache-stable 0.4.1
fastapi-cache-stable 0.4.1 — factory-route cache isolation
Status: release preparation only. Not published.
The current public PyPI release remains0.4.0until the manual 0.4.1
publication is completed and verified.
What's fixed
Factory-created FastAPI handlers can share the legacy default key when they
have the same module/name, arguments and namespace, even when they serve
different routes. Published 0.4.0 can therefore replay /a's cached
response from /b. 0.4.1 partitions the default cache key for:
- functions with code free variables (
co_freevars); - handlers wrapped by decorators that set
__wrapped__, including
functools.wrapswrappers whose factory values are bound as defaults; - local functions and lambdas;
- explicitly decorated module-level handlers with
__wrapped__.
The partition uses stable request method, case-normalized Host, mount root,
request path and the legacy digest. Unwrapped module-level handler keys,
the exported default_key_builder and custom builders are unchanged.
Old generated/wrapped entries are intentionally not reused; affected routes
will take an initial MISS and rotate to the new key. Read the migration guide.
Also included
- The docs-only Towncrier classifier from #67/#71. Markdown/RST-only changes
no longer require a fictional news fragment; source, packaging, tests,
workflows, examples and scripts still do. - A changelog correction for
0.4.0: the already-shippeduvicornremoval
(#44) and read-only Dependabot delta (#46) are now recorded.
Verification
- Exact PR head:
0f26788dac3eced92e96b81045920163696deabb. - 48 unique GitHub checks green on the PR; the full Python/Redis matrix,
lint, typecheck, security audits, wheel/sdist and CodeQL passed. - Dedicated HTTP regression for factory closures,
functools.wrapsand
default-bound values:/a → A,/b → B, MISS/MISS/HIT/HIT. - Seeded old cache entries are not read; ordinary unwrapped module-level
keys remain identical;clear(namespace=...)is covered with InMemory
and Redis 7. - Final 0.4.1 wheel/sdist hashes, TestPyPI/PyPI runs and provenance are
recorded in the release status after publication.
Limits
Generated-route keys include Host and require edge Host validation
(TrustedHostMiddleware or equivalent) to avoid fragmentation/resource
exhaustion; Host is case-normalized only, not port/alias normalized. Hidden
contextvars, middleware, tenant identity and other request context remain
the application's responsibility and are tracked in #53. Separate
applications sharing a host/path/backend prefix still need distinct prefixes.
Duplicate module-level names and direct non-ASGI @cache calls are not
covered by this patch. Do not treat a cache key as an authorization boundary.
Install after publication
python -m pip uninstall -y fastapi-cache2
python -m pip install "fastapi-cache-stable[redis]==0.4.1"
python -m pip checkDo not run this before confirming that 0.4.1 exists on PyPI.
Published artifacts
- PyPI 0.4.1
- Wheel:
fastapi_cache_stable-0.4.1-py3-none-any.whl— SHA-256a68c770ebdd6dff06e7a6b282b71be1a60dc020b7d3f0b971c307a83489d708d - sdist:
fastapi_cache_stable-0.4.1.tar.gz— SHA-256e171db38e12b8a5b1815a5d781018b39d4af883be0d65ed01a6162cfeb0417af - TestPyPI workflow
- Production PyPI workflow
- Tag
v0.4.1targetsed1000bc09f7a17e3d93767e97d55eef77f5605b.
TestPyPI, PyPI and the workflow artifact are byte-identical. PyPI provenance binds the artifacts to stable, commit ed1000bc09f7a17e3d93767e97d55eef77f5605b and production run 44772219414. The final wheel passed clean installation, pip check, the factory/functools.wraps regression, and the real Redis compatibility suite. The pre-publication Dependabot delta found 21 unchanged accepted alerts and no new material findings.
fastapi-cache-stable 0.4.0
fastapi-cache-stable 0.4.0 — Redis client compatibility expansion
Status: published 2026-11-20.
PyPI: fastapi-cache-stable==0.4.0.
What's new
The optional [redis] and [all] dependencies now accept newer
redis-py clients with Python-specific version constraints. Redis client
versions are distinct from Redis server versions.
| CPython | Optional redis-py requirement | Verified client examples |
|---|---|---|
| 3.8 | >=4.2.0rc1,<6.2 |
4.6.0, 5.2.1, 6.1.x |
| 3.9 | >=4.2.0rc1,<7.1 |
4.6.0, 5.2.1, 7.0.1 |
| 3.10–3.13 | >=4.2.0rc1,<8.2 |
4.6.0, 7.2.1, 8.1.0 |
This preserves redis-py 4.x migration compatibility and adds tested
options on supported interpreters. The range caps are intentional;
compatibility with untested future versions is not claimed. Python
>=3.8,<3.14 and the public fastapi_cache import remain unchanged.
No RedisBackend cache-key format, binary serialization or runtime behavior
change is intended by this release. A change of redis-py itself may affect
other application code sharing the same client.
Integration evidence
- #62 research:
28 real-server Redis/Python/client profiles, conditional metadata resolution
tests and separate installed-wheel FastAPI probes. - #63 implementation:
12 release-shaped wheel lanes, 4 source-distribution lanes, Redis server
6.2/7.0/7.4/8.0 checks, Python 3.8–3.13, targeted redis-py audit, pip
installation and metadata tests. The 50 GitHub checks were successful
on the implementation HEAD prior to merging. - A maintainer reported 48 passing selected tests per profile using
real-estate-arg@4c4b6030with the final #63 wheel, actual standalone
Redis 7.4.7 / RedisBackend, redis-py 4.6.0 → 7.2.1 → 8.1.0 → 4.6.0 rollback
andpip checkpassing each time. This is local maintainer evidence,
not an archived independent Actions run. It used a temporary test fixture. - The version-bumped 0.4.0 wheel and sdist were built from the release
branch and independently installed before publication. The final hashes
and publication runs are recorded in the
release status.
Scope and limitations
- In scope: standalone Redis clients and operations proven in the
matrix, RESP2/RESP3, Redis ACL authentication, binary cache payloads with
decode_responses=False, cache MISS/HIT and targeted namespace clearing. - Not certified: Redis Cluster, Sentinel/failover, TLS and managed Redis
providers. Redis Cluster namespace clear continues to raise
NotImplementedError. Usingdecode_responses=Truewith arbitrary
@cachebinary payloads is not supported. - Security boundary: Python 3.8–3.10 are EOL, functional-compatibility
targets only. The project's best-effort security-supported environment is
server-side CPython 3.11–3.13; this release does not fix unrelated
vulnerabilities in consumer applications, FastAPI, Starlette, AnyIO or
other runtime dependencies. Check the current security audit and
SUPPORT.md before production deployment. - The independent
Vary/hidden-context limitations in
#53 are not
solved by redis-py compatibility changes.
Installation
In a clean virtual environment:
python -m pip uninstall -y fastapi-cache2
python -m pip install "fastapi-cache-stable[redis]==0.4.0"
python -m pip checkNever co-install the upstream and this fork: both provide fastapi_cache.
Pin the selected redis-py version if sharing a Redis client with other
libraries; test with real application traffic and preserve a rollback pin.
See MIGRATION.md for authentication and cache isolation
caveats. InMemory-only consumers can omit the Redis extra.
Publication verification
The version-stamped wheel and sdist were built from the final release branch,
checked with twine check, installed in clean environments and exercised with
redis-py 4.6.0 and 8.1.0. The final wheel was also run against the disposable
real-estate-arg consumer with 4.6.0, 7.2.1, 8.1.0 and rollback. Exact hashes,
workflow runs, provenance and residual security notes are recorded in the
0.4.0 release status. #47 closes only after the
published artifacts are verified; #53 remains open for Vary/hidden context.
Published artifacts
- PyPI 0.4.0
- Wheel:
fastapi_cache_stable-0.4.0-py3-none-any.whl— SHA-256dfb887cc79e10b2d9dd91d1c516a35f1266dcf60e37cfcf52fd553d06158bbeb - sdist:
fastapi_cache_stable-0.4.0.tar.gz— SHA-25653e6635c78f10ae0c206891216c10f0689eea7cc3e87181a70f9540a71f696b2 - TestPyPI workflow
- Production PyPI workflow
- Tag
v0.4.0targets8d2dfe2ec5c74dbfac394b468a6bf13445f920d1.
TestPyPI, PyPI and the workflow artifact are byte-identical. PyPI provenance binds the artifacts to stable, commit 8d2dfe2ec5c74dbfac394b468a6bf13445f920d1 and production run 44670980627. The final wheel passed the real-estate-arg consumer suite with redis-py 4.6.0, 7.2.1, 8.1.0 and rollback; the pre-production Dependabot delta found no new material findings.
fastapi-cache-stable 0.3.1
fastapi-cache-stable 0.3.1 — security/correctness patch
0.3.1 is a patch release for the published 0.3.0 stable line.
It does not add features, change the Python/Redis support ranges or
alter the default cache-key digest for ordinary parameter-only routes.
Request-dependent cache variants
The default key builder hashes the endpoint identity and its function
arguments. It cannot see values read indirectly from Request.headers,
Request.state or middleware. A route whose response varied with such
values could therefore replay a cached response from a request with
different headers.
In 0.3.1, an endpoint that explicitly declares Request and uses
the default key builder bypasses cache reads and writes. Endpoints
using a custom key builder keep caching and remain responsible for
including every response-defining dimension (user, tenant, locale,
content negotiation and hidden dependency inputs). FastAPI Header(...)
parameters already present in the function arguments remain represented
in the key and keep their normal HIT/MISS behavior.
This is a deliberate behavior change: affected routes may lose cache
hits until they adopt a reviewed custom key builder. Old cache entries
are not deleted; they remain until TTL or targeted cleanup. The internal
default key format is unchanged for other routes.
Residual limitation: this mitigation cannot detect headers or ambient
state consumed by routes that do not declare Request, nor unsafe
custom key builders. Track #53
for the remaining Vary-aware design.
Documentation
Also includes the post-0.3.0 publication status, release provenance,
migration/support guidance, roadmap links and tested quickstart from
#52.
Install
Use a fresh environment and do not co-install fastapi-cache2:
python -m pip uninstall -y fastapi-cache2
python -m pip install "fastapi-cache-stable[redis]==0.3.1"
python -m pip checkVerification
- Full CI matrix for the release commit (Python 3.8–3.13 legacy/modern
profiles, lint, types, Redis clear integration, optional backends,
build/twine, CodeQL and security profiles). - Consumer check on
real-estate-arg: 46 targeted tests passed with
published0.3.0and with the0.3.1candidate; HIT/MISS behavior
was unchanged for its default-builder andRequest+ custom-builder
routes. No consumer route combines a declaredRequestwith the
default builder, so this consumer loses no cache hits. - Published wheel/sdist hashes and provenance are recorded in the
GitHub release and release-status evidence.
These checks do not guarantee the absence of vulnerabilities in
arbitrary consumer applications. The scoped maintainer decision on
the previously accepted open GHSA remains unchanged for 0.3.x.
Published artifacts
- PyPI 0.3.1
- Wheel:
fastapi_cache_stable-0.3.1-py3-none-any.whl— SHA-2566b16cdac697e942f79a3202b03d00174768b4060335eada1190123cc31b3136c - sdist:
fastapi_cache_stable-0.3.1.tar.gz— SHA-256ef6ae11e043ebd53b0ecd5df526e6039494b80ecf75d925d3b78ae234d2e4b88 - PyPI publication workflow
- Tag
v0.3.1targetsf55d534e9ed99d74229d8c152bd5d21a26b65b43.
PyPI signed provenance for both files is bound to publish.yml, tag v0.3.1, this commit and the publication run. TestPyPI published the same byte-identical artifacts.
fastapi-cache-stable 0.3.0
fastapi-cache-stable 0.3.0 is the first stable release of this community-maintained fork of fastapi-cache2==0.2.2. It retains the fastapi_cache import. Review the migration guide before upgrading.
Highlights
- Requests with
AuthorizationorCookiebypass caching by default; authenticated caching requires an identity-aware key builder. - Stable weak ETags, conditional
If-None-Match, improvedCache-Controlhandling, and bypasses for responses whose status, headers, cookies, or background tasks cannot be safely reproduced. - Targeted key and namespace clearing, Redis standalone
SCAN/UNLINK, and per-instance InMemory storage. - Optional Pydantic v2
TypedJsonCoder, opt-in FastAPI response-model inference, and explicitFastAPICache.init()reconfiguration withreset()orforce=True.
Install
python -m pip install "fastapi-cache-stable[redis]==0.3.0"
python -m pip checkCompatibility and limits
- Python
>=3.8,<3.14; server-side CPython 3.11–3.13 is recommended for best-effort security maintenance. Python 3.8–3.10 are functional legacy-compatibility targets only. - The supported Redis client line is redis-py 4.x. Memcached and DynamoDB remain experimental; Redis Cluster namespace clearing is not implemented.
The repository records a release-scoped acceptance of 21 previously captured open Dependabot advisories. This is not a dismissal of those alerts or a guarantee about downstream applications; see the risk decision.
See the full changelog and PyPI release files.
fastapi-cache-stable 0.3.0b1
0.3.0b1 - 2026-11-16
Bugfixes
-
FastAPICache.init()now raisesRuntimeErrorwhen called a second time instead of
silently keeping the first configuration. CallFastAPICache.reset()before
re-initializing, or pass the keyword-onlyforce=Trueto replace the current configuration
explicitly. Applications that callinit()from a lifespan handler must passforce=True
or reset first, because the handler runs on every startup. The bundled examples do this.The decorator now resolves the coder and expiry per request instead of overwriting the
values captured at decoration time, so a re-initialization also applies to endpoints that
were already called. Reusing the same backend and namespace across coders can leave
entries in an incompatible format; flush or rotate the namespace when the coder changes. #18
Improved Documentation
-
Add GitHub issue forms for bug reports and feature requests, with a template chooser that
links to the support policy, migration guide, compatibility contract and private
vulnerability reporting. Blank issues are disabled so reports arrive with the information
needed to triage them.Enable GitHub Issues for the repository and point every bug-reporting reference at a real
channel instead of "when issues are enabled". Security reports continue to use private
vulnerability reporting, never a public issue. The security response targets are now stated
as best-effort targets rather than contractual guarantees. #20
Misc
-
Remove the unused
tox.iniand thetoxdevelopment dependency. CI already runs the
supported matrix through GitHub Actions, andCONTRIBUTING.mddocumentspip,pytest,
Ruff and pre-commit instead of tox, so the tox file only declared a stale Python 3.7-3.11
matrix that no longer matched reality.Add unit tests for the Memcached and DynamoDB backends using fake clients, and run them in a
newoptional-backendsCI job. They cover key encoding, get/set, TTL handling and the
unimplementedclear. Both backends remain Experimental: there are no integration tests
against a real service, andMemcachedBackend.get_with_ttl()still returns a fixed3600
instead of the real remaining time. #19
0.3.0a2
0.3.0a2 - 2026-11-14
Bugfixes
- Bypass the cache for requests with a non-empty
AuthorizationorCookieheader by
default. Addcache_authenticated=Trueto opt in with an identity-awarekey_builder;
opting in with the default key builder raisesValueErrorfor authenticated requests.
Backend error logs now report only the endpoint, namespace, and exception type; they no
longer include the cache key, exception message, or traceback.
Clear or rotate the cache namespace when upgrading from versions that cached authenticated
responses. #12 - InMemory backend:
expire=Nonenow means no expiration instead of immediate expiry, and each
backend instance has its own store and lock. Existing process-local entries are not shared
between instances; use a shared backend for cross-process caching. #13 - Emit
Cache-Control: max-ageonly when the effective expiry is valid and non-negative.
expire=Noneand no-expiration InMemory hits no longer producemax-age=Noneor
max-age=-1;ETagand the cache-status header are still emitted.expire=0keeps the
legacy fallback to the globalexpirevalue. #14 - Use a stable SHA-256 digest for the ETag and emit it as a quoted weak validator
(W/"<digest>").If-None-Matchnow uses weak comparison, supports comma-separated lists
and*, and is evaluated on both cache hits and misses, including after
Cache-Control: no-cache. Malformed entity-tags are ignored. The ETag value changes once
when upgrading; clients revalidate and receive the new value. #15 - Namespace the internal
_spec_typemarker as__fastapi_cache_spec_type__so user payloads
with_spec_typeare preserved.JsonCodernow caches only simpleJSONResponseobjects
(status200,application/json, no custom headers, no background task) and bypasses other
non-JSON responses (StreamingResponse,FileResponse,RedirectResponse, plainResponse,
templates). Responses withSet-Cookie,Cache-Control: no-store/private, or a background
task are never cached, regardless of the coder. The injectedresponseobject is also
checked before a cache read and before writing; cookies,Cache-Control: no-store/private,
background tasks, non-200statuses, and custom headers bypass the cache.PickleCodercaches serializable response
objects it can reproduce faithfully and bypasses streaming, file, and template responses. Old
cache entries written with_spec_typeare treated as user data; flush the namespace if you
cachedatetime/date/Decimalvalues. #16
Improved Documentation
- Document the published
0.3.0a1release and pin the alpha install commands. #11 - Document the
0.3.0a2release status, pin the alpha install commands, and record the tested
Redis/redis-py compatibility. The auth/privacy, InMemory,Cache-Control, ETag,
_spec_type, and response-bypass fixes are now available in0.3.0a2. #17
0.3.0a1
Alpha release 0.3.0a1.
Experimental, not production-ready. The fastapi_cache import and public API are unchanged from fastapi-cache2 0.2.2.
Implemented
- Error responses (status >= 400) are not cached.
- Opt-in
TypedJsonCoderfor Pydantic v2 typed restoration. clear(key=...)deletes only that key; namespace clears require the:boundary; Redis standalone usesSCAN/UNLINK; Redis Cluster namespace clear raisesNotImplementedError.- Legacy compatibility matrix: Python 3.8/3.9, FastAPI 0.111.1, Pydantic 1.10.27/2.8.2.
Targeted for later 0.3.0 pre-releases
Auth/privacy defaults, stable ETag, InMemory expiry/isolation, Cache-Control/max-age, non-JSON bypass, _spec_type collision handling, explicit re-init(), and the Redis client/server matrix.
Install
pip install fastapi-cache-stable==0.3.0a1See MIGRATION.md and COMPATIBILITY.md for migration notes and known limitations.