Cache feed/llms.txt bodies, serve with content-hash ETags
Rendering every article per request is expensive. Bodies are now RAM-cached keyed by the public base URL and cleared from _invalidate_pages (the same hook that drops the page render cache on any content/settings write). Responses carry a blake3 content-hash ETag and answer 304, so polling feed readers revalidate cheaply; matching page behavior, 304 revalidations are not recorded in analytics.
This commit is contained in:
+7
-2
@@ -171,11 +171,16 @@ _render_gen = 0
|
||||
|
||||
|
||||
def _invalidate_pages() -> None:
|
||||
"""Drop cached page bodies and bump the render generation (ETags);
|
||||
any content change also re-runs translation dispatch."""
|
||||
"""Drop cached page bodies (and the feed/llms.txt export bodies) and
|
||||
bump the render generation (ETags); any content change also re-runs
|
||||
translation dispatch."""
|
||||
global _render_gen
|
||||
_render_gen += 1
|
||||
_cached_body.cache_clear()
|
||||
# Local import: pagerite.feeds imports this module.
|
||||
from pagerite import feeds
|
||||
|
||||
feeds._cached_feed.cache_clear()
|
||||
dispatcher.schedule()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user