caching
Technical notes on web development, DevOps, and AI integration.
3 articles
- 10:44backend
One Query Param, Three Layers: A Safe ?module= Filter
Adding a ?module= filter is not just a WHERE clause: 400 validation at the handler, a parameterized subquery, and a cache key per filter combination.
TL;DR: A naive SQL-only module filter would poison the shared mappoints:all cache, leaking filtered results to unfiltered requests and vice versa. The fix layers validation against six allowed modules with a 400 error, a parameterized subquery, and branched cache keys by module and category. This isolates each response variant and prevents cross-contamination.
#go#api#caching - 12:32backend
I Almost Deleted My Cache One Key at a Time
Mass-deleting Redis keys felt right until I read the docs. Versioned keys with INCR bumps make stale chat answers unreachable instead.
TL;DR: Editing an article left the Redis-cached AI answers stale, and the author's first fix—scanning and deleting every ask: key—turned out to solve the wrong problem. SCAN is non-blocking; the real pain is tracking key families across workers forever. Versioned keys fix it: bake versions into key names, bump with INCR on edits, and let TTL clean up.
#redis#caching#cache-invalidation - 19:19tooling
One Qwen chat for two articles: followups via chat URL
A --chat-url option lets EN translation reuse the existing Qwen chat, one chat for two articles, plus how force-cache works in Next.js 15.
TL;DR: The author's translation pipeline burned through free Qwen quota because every generate run opened a new chat, so they added a --chat-url option to reuse existing sessions, halving quota use. Next.js 15 stopped caching fetch by default, requiring explicit force-cache settings. A tldr-tolerant push now ignores server metadata, preventing CI failures.
#automation#qwen#nextjs