docs: pre-release docs pass for 0.3.8 - #290
Merged
Merged
Conversation
- Add zh-TW translations of LOCK.md and CONTRIBUTING.md and wire them into the zh-TW nav and index; give the zh-TW index heading ids that match the English page. Record in DEVELOPMENT.md that the API reference, DEVELOPMENT.md and the changelog stay English-only. - JWT_CLAIMS: rewrite the custom-serializer examples on a standalone TokenSerializer that reads the public SessionConfig fields instead of JWTTokenSerializer's private attributes; wire the examples to FastAPICacheXSessionMiddleware and require_user_session. - Fix wrong statements: only Redis and Memcached prefix their keys; invalidate() raises backend errors; CacheLock is a lease, not a fencing lock, and has no MemoryBackend fallback; counter_entry(n) with a negative n cannot be incremented on Memcached. - APP_CACHE: nested or empty CacheManager prefixes share clear(). - HTTP_CACHING: the key builder only runs when the backend is used. - zh-TW: bring BACKENDS, HTTP_CACHING and CACHE_FLOW back in line with the English pages (TTL-less routes skip the backend, missing BACKENDS passages). - CLAUDE.md: CacheLock subsystem, expire_if_equals, key prefixes, FastAPICacheXSessionMiddleware and cookie transport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #214
Summary
Each change is documented. Checked every
## [Unreleased]entry and every entry collected in #286 against the guides and the code.HTTP_CACHING:invalidate()no longer claims it never raises. It returnsFalsewithout a backend, but backend errors propagate.HTTP_CACHING: new paragraph saying a custom key builder only runs when@cacheuses the backend (@cache wrapper: build the key lazily and tidy the request check #182).LOCK: the opening now describes a lease, not a fencing lock (see CacheLock: optional automatic renewal and a way to detect a lost lock #250).LOCK: new Backend bullet. There is noMemoryBackendfallback, soacquire()raisesBackendNotFoundErrorwhen no backend is set.LOCK: the Redis note now names bothSET NX EXand the Lua scripts.require_user_session/AuthenticatedSession, includingUserSessionDepin the dependency list;get_session(touch=True);media_typein/cached-records;CacheBackendfallback;rotate_session_idandclear().Wrong statements from the review comment
BACKENDS,HTTP_CACHING(EN and zh-TW) andCLAUDE.md: only the Redis and Memcached backends prefix their keys;MemoryBackendhas no prefix.BACKENDS:counter_entry(n)is qualified for Memcached, whose counters are unsigned. A negativenthere cannot be incremented and raisesCacheXError(Memcached: validate key_prefix, and qualify the counter_entry(n) claim #239). Checked against a live Memcached 1.6 server:counter_entry(5)increments to 7, whilecounter_entry(-3)raisesCacheXError.APP_CACHE(EN and zh-TW):CacheManagerprefixes that nest (cache:andcache:users:) shareclear(), and an empty prefix clears everything (CacheManager: typed reads, incr, and get_many/set_many #249).zh-TW parity
LOCK.mdandCONTRIBUTING.mdtranslations, added to the zh-TW nav.index.mdnow matches the README:{#id}s matching the English page (they had none).BACKENDS: added the four missing passages:clear_pattern()logical-key/deprecation bullet;encoding="utf-8"paragraph and its inline comment;incrementsentence;expire_if_equalsbullet (「這五個方法」).HTTP_CACHING,CACHE_FLOW: the TTL-less (ttl=None/ttl=0) behaviour was stale. The note, table row, pseudo-code andmax-agecell now say the backend is neither read nor written.docs/DEVELOPMENT.md("Traditional Chinese translation") records thatapi/*,DEVELOPMENT.mdand the changelog stay English-only.Examples match the API
JWT_CLAIMS(EN and zh-TW): the custom-serializer examples are rewritten on a standaloneCustomClaimsJWTSerializer.TokenSerializerprotocol with PyJWT and reads the publicSessionConfigfields.JWTTokenSerializerprivate attributes.extra_claims(),required_claimsandcheck_claims().JWT_CLAIMS: examples useFastAPICacheXSessionMiddlewareinstead of the deprecatedSessionMiddleware. The complete example guards the profile route withrequire_user_session.memcacheextra except where they describe its deprecation.CLAUDE.mdCacheLocksubsystem entry andexpire_if_equals("five" atomic primitives).Verification
uv run --group docs zensical build --strict --cleanuv run --group docs zensical build --strict --clean -f zensical.zh-TW.tomlindex,LOCKandCONTRIBUTING.CACHE_FLOWpassages.from fastapi_cachex… import …in the Python code blocks of both languages resolves against this branch (44 names).MemoryBackend:JWT. The serializer base class, both examples, both test functions and the complete app ran through
TestClient:iss/aud, andexpfollowingexpires_atincluding a sliding renewal;jti, the wrong audience, a tampered signature, another tenant and another API version, all asSessionTokenError;401without a token and for another tenant's token.It ran with warnings as errors; there were none.
LOCK.
acquire()without a backend raisingBackendNotFoundError;LockTimeoutErrorfromasync with.RuntimeErroron re-acquiring the same instance.extend()/release()returnFalseand another holder gets the lock.timeoutreturnsFalse; the default blockingacquire()waits until the lock is released.pre-commiton the changed files anduv lock --checkpass.CHANGELOG
None: docs only.