Home / Companies / Upstash / Blog / Post Details
Content Deep Dive

Local replicated cache with Redis

Blog post from Upstash

Post Details
Company
Date Published
Author
Sancar Koyunlu
Word Count
3,095
Company Posts That Month
9
Language
English
Hacker News Points
-
Post removed?
No
Summary

QStash, a message queue and scheduler, needed a solution to access hot data such as user records, quotas, plan limits, and API keys with zero network cost, despite using Redis as the source of truth. To achieve this, a six-step process was implemented to create a local in-memory cache for each process, synchronizing changes across processes via Redis streams for durability. The steps included setting up a TTL cache, using pub/sub for invalidation, making invalidations durable with Redis streams, trimming the stream based on the slowest reader, addressing the race condition between reads and invalidations, and ensuring reads are served by the primary Redis instance to avoid stale data from lagging replicas. This comprehensive approach allows for rapid data access and consistent updates across processes, ensuring that changes reach all instances within milliseconds. The implementation is open-source and available on GitHub for further exploration and adaptation.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.