Through TenantsDB, each tenant gets isolated key-value storage on a shared Redis instance. The proxy automatically prefixes every key with the tenant's namespace, so tenants never see each other's data. Your app connects with any standard Redis client. No SDK needed.
Redis works differently from the SQL and MongoDB databases in TenantsDB. There is no schema, no tables, no blueprints, and no DDL. You create a Redis workspace to define settings (TTL rules, key limits, patterns), then create tenants. Each tenant connects and starts using Redis commands immediately.
Redis also uses a different authentication scheme. Instead of project_id:proxy_password, Redis uses tenant_id:api_key. TLS is enabled via the rediss:// scheme (double-s) for all clients.
workspace as the tenant ID.redis-cli --tls -u "rediss://workspace:[email protected]:6379/0"
The workspace connection lets you test commands and verify settings before creating tenants. Data written to the workspace is separate from tenant data.
redis-cli --tls -u "rediss://acme:[email protected]:6379/0"
redis-cli --tls -u "rediss://globex:[email protected]:6379/0"
user:1 with different values.# Strings SET user:1 "Alice" SET user:2 "Bob" # Hashes (structured data) HSET account:1 name "Alice" balance 1000 HSET account:2 name "Bob" balance 2000 # With expiration (seconds) SET session:abc "session_data" EX 3600 # Lists (queues) LPUSH queue:jobs "job1" "job2" "job3"
All standard Redis commands work through the proxy. The proxy transparently prefixes keys for tenant isolation on L1 shared instances. Your application never needs to handle prefixing.
workspace as the tenant ID.const Redis = require('ioredis'); const redis = new Redis(process.env.REDIS_URL); // REDIS_URL=rediss://acme:[email protected]:6379/0 // String await redis.set('user:1', 'Alice'); const name = await redis.get('user:1'); // Hash await redis.hset('account:1', 'name', 'Alice', 'balance', '1000'); const balance = await redis.hget('account:1', 'balance'); // With expiration await redis.set('session:abc', 'data', 'EX', 3600);
npm install ioredis
rediss:// scheme natively for TLS connections.import redis import os r = redis.from_url(os.environ['REDIS_URL']) # REDIS_URL=rediss://acme:[email protected]:6379/0 # String r.set('user:1', 'Alice') name = r.get('user:1') # b"Alice" # Hash r.hset('account:1', mapping={'name': 'Alice', 'balance': '1000'}) balance = r.hget('account:1', 'balance') # b"1000" # With expiration r.set('session:abc', 'data', ex=3600)
pip install redis
decode_responses=True in the connection to get strings instead.package main import ( "context" "fmt" "os" "time" "github.com/redis/go-redis/v9" ) func main() { ctx := context.Background() opt, _ := redis.ParseURL(os.Getenv("REDIS_URL")) // REDIS_URL=rediss://acme:[email protected]:6379/0 rdb := redis.NewClient(opt) // String rdb.Set(ctx, "user:1", "Alice", 0) name, _ := rdb.Get(ctx, "user:1").Result() fmt.Println(name) // Hash rdb.HSet(ctx, "account:1", "name", "Alice", "balance", "1000") balance, _ := rdb.HGet(ctx, "account:1", "balance").Result() fmt.Println(balance) // With expiration rdb.Set(ctx, "session:abc", "data", 60*time.Second) }
go get github.com/redis/go-redis/v9
rediss:// scheme and enables TLS automatically.| Database | Username | Password |
|---|---|---|
| PostgreSQL, MySQL, MongoDB | project_id (e.g., tdb_2abf90d3) |
proxy_password |
| Redis | tenant_id (e.g., acme) |
api_key (e.g., tenantsdb_sk_...) |
Redis uses the tenant ID as the username because tenant isolation happens at the connection level. The proxy identifies which tenant is connecting from the username and prefixes all keys accordingly. For workspace access, use workspace as the username.
On L1 shared instances, all tenants share the same Redis server. The proxy isolates tenants by automatically prefixing every key with the tenant's namespace. Your application sends SET user:1 "Alice" and the proxy stores it as tdb_xxx_tenant_acme:user:1. On read, the prefix is stripped. Your application never sees the prefix.
Redis settings are configured per workspace and differ from the SQL and MongoDB settings.
| Setting | Description |
|---|---|
| default_ttl | Default expiration (seconds) applied to keys that don't have an explicit TTL set. |
| max_keys | Maximum number of keys allowed per tenant. |
| patterns | Pattern-specific TTL rules. Each pattern (e.g., session:*) can have its own TTL and an enforced flag that overrides user-set TTLs. |
All connections require TLS. Use the rediss:// scheme (double-s) in your connection URL. TLS is terminated at the edge by HAProxy. Every Redis client library supports rediss:// natively.
There are no proxy-level size restrictions. The Redis native limit of 512MB per value applies. Keep in mind that large values use their full size in memory on the Redis server. Connection strings stay the same when tenants migrate between L1 and L2.