Redis primer
A fast path to understanding Redis — the in-memory data store that powers Meridian's session cache, rate limiter, and real-time leaderboards.
What is Redis?
Redis is an in-memory key-value store. It keeps all data in RAM, which means reads and writes happen in microseconds. Meridian uses it for anything that needs sub-millisecond latency — license validation lookups, ephemeral session state, and abuse-detection counters.
Data structures
Beyond simple strings, Redis gives you hashes, sorted sets, lists, and streams. Meridian leans on sorted sets for time-windowed rate limiting and hashes for user session metadata. Each structure has atomic operations, so you never worry about race conditions.
Persistence
Redis can snapshot to disk (RDB) or append every write to a log (AOF). Meridian runs with both disabled for pure cache workloads — if the instance restarts, sessions rebuild from the database. For leaderboard data, we enable AOF so rankings survive reboots.
Key expiration
Every key can carry a TTL. Meridian sets 15-minute expirations on license-check caches and 24-hour expirations on abuse-tracking entries. Expired keys are evicted automatically, keeping memory usage predictable.
Connecting from Node
Use the ioredis library. A single Redis instance handles connection pooling, auto-reconnect, and pipelining. Meridian wraps it in a thin utility that logs slow commands and emits Prometheus metrics for every operation.