Crescendo Lab Docs Deploy
English
Sign up

Add a Redis cache to your project

Create a private Redis cache on Google Memorystore (S to XL, optional HA and TLS) and connect it to a project as REDIS_URL, from the console or an AI tool.

Last updated

The quickest way: let the deploy create it#

If your code reads REDIS_URL (or another Redis connection variable) and the project has no value for it yet, deploying from an AI tool or uploading in the console creates a size S, Basic cache and connects it before the build starts. Creating it takes about 5 minutes. When this happens and when it doesn't: Databases and caches the code needs.

What you get#

A dedicated Redis 7.2 instance on Google Memorystore, in Taiwan (asia-east1), for one environment.

SettingChoices
MemoryS 1 GiB, M 2 GiB, L 4 GiB, XL 8 GiB. It can be expanded later, never reduced.
AvailabilityBasic, or High availability with a replica that takes over. Fixed once created.
TLS encryptionOff by default. Fixed once created. With TLS, the project also needs the CA certificate.
Eviction policyWhat happens when memory is full: noeviction, allkeys-lru, allkeys-lfu, allkeys-random, volatile-lru, volatile-lfu, volatile-random or volatile-ttl. Can be changed.
  • Private. The cache has a private address only. Only projects you connect can reach it, and only with the AUTH password, which is always on. You can't reach it from your own computer; from an AI tool, caches_command runs single commands for you.
  • What the plan allows. Free has no caches. Pro allows 5, Team 20, Business by contract, all four sizes.
  • Price. Cache prices aren't published yet: the console shows no estimate, and caches_options answers none. High availability costs more than Basic.

Create a cache#

  1. Open Caches and select Create cache.
  2. Enter a Name: lowercase letters, digits and hyphens, starting with a letter, up to 63 characters.
  3. Choose the Memory, Availability, TLS encryption and Eviction policy. For sessions or data you can't lose, use noeviction; for a pure cache, allkeys-lru.
  4. Confirm. The cache is ready in about 5 minutes.

Connect a project#

Connecting writes the connection into the project's secrets and lets the project through the cache's network. Nobody sees the password.

  1. Open the cache, go to Project connections and select Connect project.
  2. Choose the project and the variable names, then Preview ENV changes. The preview lists any variables that would be replaced.
  3. Confirm, and keep Restart project after injection on so the project reads the new values.

The url part is redis://:<password>@<private address>:6379/0; with TLS it starts with rediss:// and uses the port Memorystore gives a TLS cache (6378). Most clients take it as it is. With TLS, also give the client the CA certificate:

server.js
import { createClient } from "redis";

const redis = createClient({
  url: process.env.REDIS_URL,
  socket: process.env.REDIS_CA ? { tls: true, ca: process.env.REDIS_CA } : undefined,
});
await redis.connect();

A cache must be Ready before a project can connect. Disconnect removes the project's access; its credentials are removed once its network access is revoked.

Change or delete a cache#

  • Rename, expand memory or change the eviction policy under Manage, or with caches_update. TLS and availability can't change: create a new cache instead.
  • Delete cache deletes every key permanently. Project connections are revoked first.
  • The cache's Monitoring shows memory, connections, commands, hit rate and evicted keys. Any evicted keys mean the cache is full: a larger size helps.

From an AI tool, caches_update and caches_delete need the cache's current generation from caches_get. caches_command runs one Redis command from an allowlist: reads at once, writes after you confirm. AUTH, CONFIG, EVAL, FLUSH and KEYS are refused. See MCP tools › Redis (caches).