Skip to content

Redis fragment cache with tag-based invalidation #91

Description

@tayebmokni

Summary

Implement a Redis-backed fragment cache per doc 07 §15.3. Stored as frag:{key} keys with sibling tag:{tag} sets whose members are keys. InvalidateTags does a SUNION and DEL pipeline. Default TTL 5 minutes as safety net; tag invalidation is the primary mechanism. LRU-trim tag sets at 100k members (if a tag touches that many fragments, the cache hierarchy is wrong).

Design reference

  • docs/07-media-performance.md §15.3

Acceptance criteria

  • FragmentCache interface implemented per §15.3 signature (Get, Set, InvalidateTags)
  • Keys stored as frag:{key}; tag membership via Redis sets tag:{tag}
  • InvalidateTags uses SUNION + pipelined DEL
  • Default TTL 5 minutes (configurable per Set call)
  • Tag-set LRU trim at 100k members; logs warn when triggered
  • Unit tests with miniredis; integration test with real Redis
  • Wrapper used for "popular posts", "top commenters", "sidebar recent comments"

Dependencies

none

Complexity

M

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiGo HTTP API serverarea:cacheCache layers + invalidationphase:P3-themesPhase 3 — Themespriority:P1Important — should land in phaseskill:goGo programmingtype:featNew feature or implementation task

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions