Skip to content

Author a caching strategy and key-namespace reference in docs/cache.md #886

Description

@1nonlypiece

📌 Description

A Redis-backed cache-aside layer exists in src/lib/cache.ts and is used by vault
and analytics reads, but there is no documentation of the caching strategy: which
reads are cached, the key-namespace scheme, TTLs, invalidation triggers, and the
in-memory vs Redis fallback behaviour. Without this, contributors risk introducing
inconsistent or unsafe cache usage.

This issue authors a caching reference doc.

🎯 Requirements and Context

  • Document the key-namespace convention (including per-org namespacing) and TTL
    policy per cached resource.
  • Document invalidation triggers and the in-memory LRU vs Redis fallback.
  • Document cache versioning (CACHE_VERSION) and how to safely change cached
    shapes.
  • Provide a checklist for adding a new cached read safely.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b docs/cache-strategy

2. Implement changes

  • Author docs/cache.md reflecting src/lib/cache.ts.
  • Add src/tests/docs.cache.test.ts asserting documented env keys and
    CACHE_VERSION references exist in the code.

3. Test and commit

  • Run: npm test -- src/tests/docs.cache.test.ts
  • Cover edge cases: documented env keys exist, namespaces match code, fallback
    behaviour described.

Example commit message

docs: caching strategy, key namespaces, and invalidation reference

✅ Guidelines

  • Minimum 95% test coverage on any assertion code added.
  • Doc must match src/lib/cache.ts behaviour.
  • Timeframe: 96 hours.

🏷️ Labels

type-documentation · type-performance · area-backend · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the contributor Discord to coordinate, ask questions, and get unblocked fast: https://discord.gg/xvNAvMJf
  • Please introduce yourself in the channel before you start so we can avoid duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful reviews — reach out any time you're blocked.

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions