Redis CLI Builder
Build common redis-cli commands (SET, GET, EXPIRE, KEYS, HSET, INCR) with TTL.
Redis: the in-memory data structure server
Redis was released by Salvatore Sanfilippo in 2009 as an in-memory data store written in C99. It is single-threaded around an event loop (epoll/kqueue) β one command runs at a time, but each command is atomic and the loop processes millions of operations per second. Optional durability is handled by RDB snapshots and the AOF append-only log; you can run it as a pure cache, as a persistent store, or any blend of the two.
Data types beyond strings
- String β
SET,GET,INCR,APPEND,EXPIRE. Counters and cache values. - List β
LPUSH,RPUSH,LRANGE,BLPOP. Perfect for FIFO queues. - Hash β
HSET,HGET,HMGET. Stores objects field-by-field without re-serialising. - Set β
SADD,SMEMBERS,SINTER. Unique members with fast intersections. - Sorted Set β
ZADD,ZRANGE,ZRANGEBYSCORE. Leaderboards and time-windowed indexes. - HyperLogLog β
PFADD,PFCOUNT. Approximate cardinality in ~12 KB even for billions of items. - Geo β
GEOADD,GEOSEARCH. Stores lat/long pairs. - Streams β
XADD,XREAD, consumer groups. A Kafka-style log built into Redis. - Bitmap / Bitfield / Pub/Sub β feature flags, telemetry counters and fan-out messaging.
Persistence, replication and high availability
RDB writes a binary point-in-time snapshot of the dataset on a schedule (save 60 10000) β small and fast to reload. AOF appends every write to a log with fsync tunable as always, everysec (recommended) or no. For high availability you can deploy Sentinel (monitors a primary, promotes a replica on failure) or Redis Cluster, which shards keys across 16384 hash slots using CRC16(key) mod 16384 for automatic horizontal scaling.
Expiration, eviction and pipelining
TTLs are set with EXPIRE key seconds, EXPIREAT, or directly in SET key value EX 60; PERSIST removes it and TTL/PTTL inspect it. When maxmemory is hit, the eviction policy decides who leaves: noeviction, allkeys-lru, allkeys-lfu, volatile-ttl and friends. Pipelining sends many commands without waiting for the response of each β round-trip latency drops to a single RTT and throughput often jumps 5β10Γ. MULTI/EXEC wraps a batch in a transaction; WATCH turns it into optimistic locking. For server-side atomicity, EVAL runs a Lua 5.1 script as a single command (Redis 7+ also offers persistent Functions).
Common use cases
Roughly 90% of Redis deployments are cache layers in front of a relational database, but the same engine powers session stores, rate limiters (token buckets via INCR + EXPIRE), background-job queues (List or Streams), pub/sub fan-out, leaderboards (Sorted Set) and real-time analytics. The official modules ecosystem extends it further: RediSearch (full-text and vector), RedisJSON, RedisBloom, RedisTimeSeries and RedisGraph.
Diagnostics and pitfalls
INFO dumps memory, persistence and replication stats; CLIENT LIST shows connected clients; SLOWLOG GET lists slow queries; MONITOR streams every command in real time but is heavy β use it only briefly. The infamous KEYS pattern is O(N) and blocks the server β always use SCAN with a cursor. Because Redis is single-threaded, a single slow command (a giant LRANGE 0 -1, a Lua script with a tight loop) freezes every other client.
FAQ
Is Redis persistent? Configurably yes. With RDB and/or AOF enabled it survives restarts; with both disabled it behaves like a pure cache.
How do I make it highly available? Use Sentinel for a primary+replica failover topology, or Redis Cluster for sharding plus failover. Most managed offerings (ElastiCache, Memorystore, Redis Cloud) wrap one of those underneath.
Can Redis replace my main database? Rarely. It complements an OLTP database. Without RAM-sized datasets, ACID transactions across documents and complex querying, it is meant to accelerate specific workloads, not own all your data.
Is Redis still open source? Redis 7.4 changed to the dual SSPL/RSAL licence in 2024, prompting the Valkey fork under the Linux Foundation. Both speak the same RESP protocol and remain command-compatible for the foreseeable future.
Related Tools
Handwriting Generator
Convert typed text into an image with handwriting appearance. Useful for adding a personal touch to digital work.
Resume Generator
Fill a simple printable A4 CV from a form with personal data, education and experience.
Favicon Generator
Generate a favicon from text/emoji in all common sizes (16, 32, 48, 64, 192, 512). PNG download.