Connect to Plexivo Cache
Connect to Plexivo Cache over TLS with any Redis client, verifying the cache’s own certificate.
Plexivo Cache works with any Redis client. Every connection uses TLS, and your client checks the cache’s certificate against the cache’s own certificate authority.
Connection details#
Open the cache and choose the Connect tab:
- Connection string: choose Reveal to see it and Copy to copy it. Switch between Public · servers outside Plexivo and Private · your Plexivo apps in the same project.
- CA certificate downloads the certificate your client verifies the cache with, named after your cache, such as
sessions-ca.pem.
The connection string looks like rediss://default:<password>@sessions-3f9a1c.db.plexivo.app:<port>: the user is default, and rediss:// means TLS. Each cache has its own public port, so always use the one shown. Keep the string on your servers, never in a browser or mobile app.
Set two environment variables for your app: REDIS_URL to the connection string and REDIS_CA_FILE to the path of the downloaded CA file. Plexivo App Runner apps and Plexivo Kubernetes workloads you connect to the cache in Plexivo receive REDIS_URL and REDIS_CA_CERT on their own.
Node.js#
import Redis from 'ioredis';
import { readFileSync } from 'node:fs';
// One shared client per server process, outside the request handler
export const cache = new Redis(process.env.REDIS_URL, {
tls: { ca: readFileSync(process.env.REDIS_CA_FILE), rejectUnauthorized: true },
enableAutoPipelining: true,
connectTimeout: 5000,
commandTimeout: 3000
});
await cache.set('session:42', JSON.stringify(session), 'EX', 3600);Python#
import os
import redis
# Create once per worker, not once per request
cache = redis.Redis.from_url(
os.environ["REDIS_URL"],
ssl_ca_certs=os.environ["REDIS_CA_FILE"],
ssl_cert_reqs="required",
ssl_check_hostname=True,
max_connections=4,
)
cache.set("session:42", "…", ex=3600)redis-cli#
redis-cli -u "$REDIS_URL" --tls --cacert sessions-ca.pem pingVerify the certificate#
Always pass the downloaded CA file to your client, as above: tls: { ca } in ioredis, ssl_ca_certs in redis-py, --cacert in redis-cli. Your client then confirms it is talking to your cache before it sends the password. The certificate is renewed before it expires, under the same certificate authority, so the CA file keeps working.
From your laptop#
The Plexivo CLI opens an encrypted tunnel to the cache, even a private one:
plexivo db connect sessionsIt listens on 127.0.0.1:6380, or a free port if that one is taken, and prints the connection string to use. See Install the Plexivo CLI.
Fewer round trips#
For the lowest latency, connect from your Plexivo apps in the same project over the private address, keep one client open for the life of each worker, and batch independent commands: enableAutoPipelining in ioredis, pipeline(transaction=False) in redis-py. A batch is not atomic; use a transaction or a Lua script when it must be.
Next steps#
Updated 27 October 2026