Sessions that survive a restart
Keep user sessions in KiviDB so any application server can read them: hashes with a sliding expiry, replicas with automatic failover, and an append-only log on paid plans.
Keep each session in memory where every application server can reach it, expire it when the user goes quiet, and keep it through a deploy or a failed node.
Where KiviDB sits
Browser (carries a session id) → Your servers (any instance can answer) → KiviDB (the session, expiring on its own)
One key per session
- A hash per session Fields for the user, the role and whatever else the request needs. Read one field with HGET or all of them with HGETALL.
- Sliding expiry Reset the time to live on each request. A session nobody uses removes itself.
- Stateless servers Any application server can serve any request, so you can add, remove or redeploy servers without signing anyone out.
What KiviDB Cloud adds
- Replicas and failover On the Pro plan a replica takes over when the primary is lost, and the hostname your application uses stays the same.
- Durability An append-only log on paid plans, snapshots on demand, and scheduled snapshots you can switch on.
- Access control A firewall per database, closed until you open it, database users with their own permissions, and private connectivity.
Other use cases
- Caching: Keep hot data in memory in front of a slower store.
- Rate limiting: Count and cap requests per user, key or address.
- Leaderboards: Ranked lists that update as scores change.
Move sessions out of the server
Create a free database and set it as your framework's session store.