Change your application: migrate from KeyDB to KiviDB
KeyDB clients are Redis clients, so nothing changes but the address, the port, the password, and TLS for KiviDB Cloud. If the application calls EXPIREMEMBER…
KeyDB clients are Redis clients, so nothing changes but the address, the port,
the password, and TLS for KiviDB Cloud. If the application calls
EXPIREMEMBER or a KEYDB.* command, change those calls first: KiviDB answers
them with ERR unknown command.
Python (redis-py)
import os, redis
# Before
r = redis.Redis(host="keydb.internal", port=6379, password=os.environ["KEYDB_PASSWORD"])
r.execute_command("EXPIREMEMBER", "session:42", "token", 3600)
# After: KiviDB Cloud
r = redis.Redis(host="your-name.cloud.kividb.io", port=6380, username="kividbapp",
password=os.environ["KIVIDB_PASSWORD"], ssl=True, ssl_ca_certs="kividb-ca.pem")
r.hset("session:42", "token", "...")
r.hexpire("session:42", 3600, "token") # per-field expiry: hashes only
Node.js (ioredis)
// Before
const keydb = new Redis({ host: "keydb.internal", port: 6379, password: process.env.KEYDB_PASSWORD });
// After: self-hosted KiviDB
const kividb = new Redis({ host: "kividb.internal", port: 6380, password: process.env.KIVIDB_PASSWORD });
For a set or sorted-set member that must expire, store the expiry time as the
score in a sorted set and remove expired members on read
(ZREMRANGEBYSCORE key -inf <now>), or move the members into a hash and use
HEXPIRE.