Skip to content

Add a Redis-compatible cache to your app with your AI (2026)

Is your app slowing down under load? Ask your AI for a cache: connected to while over MCP, it declares one in three lines, and your app finds it in REDIS_URL.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 19, 2026.

View as Markdown

Add a Redis-compatible cache to your app with your AI: a Redis-compatible cache with Claude Code, Cursor or Codex, on while, hosted in France

The short version. Over MCP, your AI adds a Redis-compatible cache to your app, with no server to manage. Its address arrives in REDIS_URL, password included. What matters, like deleting a database, waits for a person’s approval.

Prerequisites

  • A Node.js, Python or Go app.
  • An AI that works in a terminal: Claude Code, Codex, Cursor or Gemini CLI.

Step 1: Give your AI this message

Open your AI in your app’s folder, and paste this message into it:

The message to give your AI
Connect to while with my account (while.sh/agents), then put my app on while.

Your AI adds while’s MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn’t open, type /mcp, choose while, then Authenticate. On that page, choose “A new app”, then click Authorize.

Step 2: Open your app

Your AI gives you your app’s address, for example https://mon-appli.while.cloud, over HTTPS.

What your AI does

It adds three lines to while.yaml:

while.yaml
apiVersion: while/v1
project: mon-appli
services:
  - name: web
    port: 3000
    health:
      path: /health
caches:
  - name: cache
    memory: 256Mi

The last three lines declare a 256 MiB Redis-compatible cache. Its address, password included, reaches your app in REDIS_URL1:

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

const cache = createClient({ url: process.env.REDIS_URL });
await cache.connect();
A Redis-compatible cache with while: credentials kept out of the AI's reach, every call logged in the history, a person's approval for what matters and a daily backup, in France
Around every app, while keeps the credentials, the history, the approvals and the backups.

Make the cache bigger

You, to your AI: Increase the cache to 512 MiB.

Your AI changes memory in while.yaml. When the cache is full, the keys that have gone unused the longest make room for new ones.

Keep the data after a restart

You, to your AI: Turn the cache into a job queue that never loses anything.

Your AI makes the cache durable: its data is written to disk, and no key is evicted.

Add a database

You, to your AI: Add a PostgreSQL database.

Your AI declares the database in while.yaml, and its address reaches your code in DATABASE_URL. The database is backed up every day, with a way back to a precise moment over 14 days.

Restrict your app to your colleagues

You, to your AI: Restrict the app to people in the company.

Your AI makes the service internal:

while.yaml
    access: internal

Then it asks for the Access role for your domain, @acme.com, on this app, and a person in your organization approves it.

Once your Google Workspace or Microsoft 365 is linked to while, on the Pro plan, your colleagues sign in with their usual account, and your code receives their name and email address, with no sign-in page to write.

Go back to the previous version

You, to your AI: Go back to the previous version.

In the 30 minutes after a production release, the previous version comes back in a second. After that, it takes a few seconds. Once the previous version is back, your AI reads what broke in while’s logs, fixes it and deploys again.

In the docs: Valkey cache (Redis), PostgreSQL databases, Scheduled jobs, Internal access and Versions and rollback.

Next steps

Sources

  1. Redis, connecting a Node.js app with the redis package (createClient and its url option), accessed November 2, 2026

Questions

Is it really Redis?

It’s Valkey, which is Redis-compatible: any Redis client connects to it as is.

Is the cache protected?

Yes, by a password, included in REDIS_URL.

Can I use it for a job queue?

Yes, with a durable cache: nothing is lost on restart, and no key is evicted.

Where do my app and its data run?

In France, at Nextmap. The database is backed up every day, with a way back over 14 days, once a person approves.

What happens if a version breaks something?

In the 30 minutes after a production release, the previous version comes back in a second, then in a few seconds.

Give your AI the message, and it takes care of the rest

Give this to your AI

Read while.sh/agents and help me get started with while.

Copy the message

In 3 minutes, with no sign-up, the tool has its own address. To keep it, create your account.

For a company project, write to the while team: hello@while.sh