Essential session storage is required to sign in. Optional analytics remain off unless you allow them.
Add Redis caching to a small app or API. Implement the CACHE-ASIDE pattern: on a request, check Redis first; on a MISS, read the source (DB/API), then store the result in Redis with a sensible TTL. Use the correct data types — a hash to cache an object, a string/INCR for a hit counter, and a sorted set for a small leaderboard or 'most viewed'. Set TTLs so the cache self-expires, and use SCAN (never KEYS) if you need to enumerate keys. Measure and report the cache hit ratio before/after.
Check-cache -> on-miss-load-and-populate-with-TTL implemented correctly; the cache actually offloads the source.
Hash for objects, string/INCR for counters, sorted set for ranking — chosen for the access pattern; SCAN not KEYS.
Sensible TTLs so the cache expires; understands TTL vs explicit invalidation.
Hit ratio measured and the latency/load improvement shown.
Use this README structure to make the work reviewable.
DevPath fetches a read-only, size-capped snapshot. Submitted code is never executed.
# A cache-aside layer with the right data types ## Goal Add Redis caching to a small app or API. Implement the CACHE-ASIDE pattern: on a request, check Redis first; on a MISS, read the source (DB/API), then store the result in Redis with a sensible TTL. Use the correct data types — a hash to cache an object, a string/INCR for a hit counter, and a sorted set for a small leaderboard or 'most viewed'. Set TTLs so the cache self-expires, and use SCAN (never KEYS) if you need to enumerate keys. Measure and report the cache hit ratio before/after. ## Acceptance criteria - [ ] Cache-aside correctness: Check-cache -> on-miss-load-and-populate-with-TTL implemented correctly; the cache actually offloads the source. - [ ] Right data types: Hash for objects, string/INCR for counters, sorted set for ranking — chosen for the access pattern; SCAN not KEYS. - [ ] TTL & invalidation: Sensible TTLs so the cache expires; understands TTL vs explicit invalidation. - [ ] Measurement: Hit ratio measured and the latency/load improvement shown. ## Verification - [ ] Document installation and run commands. - [ ] Record automated checks and their exact commands. - [ ] Add representative output, screenshots, or a short demo where useful. - [ ] Confirm failure paths and known constraints. ## Decision log ### Decision title - Context: - Choice: - Alternatives considered: - Tradeoffs: ## Evidence - Link each rubric criterion to the file, test, or artifact that demonstrates it. ## Known limitations - List what is intentionally out of scope and what should be improved next.