How it works
Redis stands for Remote Dictionary Server. Each item in Redis has a unique key; values are strings, hashes, lists, sets, sorted sets, streams and more. The same few commands cover most uses: set a value, get it, delete it, make it expire, and add one to a counter.
> SET session:42 "alice" EX 3600 OK > GET session:42 "alice" > INCR visits (integer) 1
SET key value EX seconds sets a value that expires after the given number of seconds. INCR adds one to the number stored at a key and starts from 0 if the key does not exist. That makes it a good fit for sessions, counters, rate limits and caches, Redis itself lists caching, queuing and event processing among its uses.
A key-value store lives in a separate process. Many programs can read and write the same keys, and the data survives a restart of any one of them, if the store is set up to keep it.
Does it keep the data?
That depends on the setting. Redis works in memory first, and you choose how much of it goes to disk: RDB takes point-in-time snapshots at intervals, AOF logs every write, and you can turn persistence off, which is sometimes done for caches.
| No persistence | Snapshots (RDB) | Append-only file (AOF) | |
|---|---|---|---|
| What is written | Nothing | The whole dataset, at intervals | Every write |
| After a crash | Everything is gone | with snapshots only, expect to lose the latest minutes of writes if Redis stops without a clean shutdown | with AOF and the default fsync every second, you can lose about one second of writes |
| Good for | A cache you can rebuild | Data you can mostly rebuild | Data you care about |
Redis suggests using both RDB and AOF for a degree of data safety comparable to PostgreSQL. Redis says to back up your database: disks break and cloud instances disappear, so copy the snapshot file somewhere else too.
Key-value, database and file storage
| Key-value store | Relational database | Object storage | |
|---|---|---|---|
| You find data by | The key | A query on any column | Bucket and key |
| Best for | Sessions, counters, caches, queues | Records you search and join | Files and backups |
| Size of one value | Small | Rows | Whole files |
| Relations between items | No | Yes | No |
Files go to S3 object storage. Records you search and join go to a database such as managed Postgres. The key-value store sits between your app and those two, for the small data you read all the time.
Do you need it?
Take a key-value store when
- You read the same small data often. A cache saves repeated work.
- Data expires. Sessions, one-time codes, rate limits.
- Several programs count together. One shared counter, one queue.
Skip it when
- You search by content. "All orders from May" is a query for a database.
- You have one program and a few settings. A file or a table is simpler.
- You cannot lose the data and will not set up persistence. Use Postgres.
Key-value on Uno
Two simple ways, both on a computer you control. For small apps, ask the agent for a Postgres database and keep a table of keys and JSON values: the data sits next to your other tables. For caching and counters, run Redis in Docker on your computer; every paid plan has root and Docker. Redis listens on port 6379, so publish it on 127.0.0.1 only, as below, and keep it closed to the internet.
Small: $5 a month
Two ways to do it on your computer
# 1. A key-value table in Postgres create table kv (key text primary key, value jsonb not null); insert into kv (key, value) values ('user:42', '{"plan":"plus"}') on conflict (key) do update set value = excluded.value; select value from kv where key = 'user:42'; # 2. Redis in Docker, saving a snapshot every 60 seconds if anything changed $ docker run --name some-redis -d -p 127.0.0.1:6379:6379 redis redis-server --save 60 1
INSERT ... ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value inserts a new row or updates the existing one. The PostgreSQL docs say most applications should store JSON data as jsonb, which can be indexed. Managed databases on Uno run Postgres only, so for Redis you run the container yourself.
The computer sleeps when idle, and memory and running programs are saved while it sleeps, so a running Redis is still there after the wake. Keep the snapshot setting anyway: it protects you from a crash or a deleted computer.
A computer for Redis and your app, from $5 a month
Every plan is a real Linux computer with root and Docker. Move up or down any time; your files come with you.
Small
A Telegram bot, a VPN, a small backend
$5/ month
- 1 vCPU · 1 GB
- 15 GB disk
- 25 GB cloud storage
- 5 boosts a month
Plus
Agents that work with your laptop closed
$20/ month
- 4 vCPU · 4 GB
- 40 GB disk
- 100 GB cloud storage
- Uno Work in the cloud
Pro
A product in production, a second MacBook
$70/ month
- 16 vCPU · 16 GB
- 120 GB disk
- 300 GB cloud storage
- Speed of a MacBook Air M4
Max
A team and many agents at once
$200/ month
- 32 vCPU · 48 GB
- 300 GB disk
- 1,024 GB cloud storage
- 5 public IPv4
Add Uno AI to any plan: 40 h of AI work a month on Small, 100 h on Plus, unlimited on Max. Today: GLM-5.3 Flash and MiMo v2.6 Pro. Or sign in with your own Claude or ChatGPT.
Questions
Is Redis a database or a cache?
What is the difference from a hash map in my code?
Key-value or a document store?
jsonb column gives you both: look up by key, or search by what is inside the value.