The options for a Redis or Valkey on a laptop in 2026, from Docker and native packages to in-process fakes, what each one gets wrong compared with ElastiCache or Memorystore, and how to keep a cache working in development without running a server.

Redis is the default answer for sessions, rate limits and cached lookups, and most backends meet it first on a laptop as a container started before the app.
That works until a teammate has a different version, a test depends on keys left over from the last run, or production runs with TLS and an auth token that the local cache never had.
Match the engine and major version your production cache runs. Valkey publishes images as valkey/valkey, with its latest release at 9.2.0 on November 19, 2026, and Redis moved to the AGPLv3 license option in 2025 per its announcement. ElastiCache and Memorystore offer Valkey alongside Redis, so a client that sticks to common commands works against either.
The differences that bite are rarely the commands, since a managed cluster usually runs with TLS and an auth token, an eviction policy set in a parameter group and a primary endpoint that changes during failover. Reproducing those locally takes extra configuration, which is the part developers skip.
For Go unit tests, miniredis runs a Redis server inside the test process with a real TCP interface and implements many but not all commands, so a Lua script or an unusual command may behave differently from the actual server. Node projects have similar in-memory fakes such as ioredis-mock. Use them for fast logic tests and keep a smaller set of tests against a actual server for anything that depends on eviction, scripting or persistence.
Encore brings infrastructure from code, so the cache is a declaration in the service rather than a container beside it. Per the infrastructure docs, caches run in memory under encore run and are provisioned as ElastiCache on AWS or Memorystore on GCP when you deploy, and the application code is the same in both.

Run in your terminal to get started locally.
The auth folder also needs an encore.service.ts that exports new Service("auth"). A login throttle and a session store cover the two things most apps use Redis for, a counter with a window and a value with a time to live:
// auth/auth.ts
import { api, APIError } from "encore.dev/api";
import { CacheCluster, IntKeyspace, StructKeyspace, expireInMinutes } from "encore.dev/storage/cache";
import { randomBytes } from "node:crypto";
// A Redis cluster: ElastiCache on AWS, Memorystore on GCP, in memory under `encore run`.
const cluster = new CacheCluster("auth-cache", { evictionPolicy: "allkeys-lru" });
// Failed attempts per email in the current 15 minutes.
const failures = new IntKeyspace<{ email: string }>(cluster, {
keyPattern: "failures/:email",
defaultExpiry: expireInMinutes(15),
});
interface Session {
email: string;
createdAt: string;
}
// Sessions live for an hour and are looked up by token.
const sessions = new StructKeyspace<{ token: string }, Session>(cluster, {
keyPattern: "session/:token",
defaultExpiry: expireInMinutes(60),
});
const MAX_FAILURES = 5;
export const login = api(
{ expose: true, method: "POST", path: "/login" },
async ({ email, password }: { email: string; password: string }): Promise<{ token: string }> => {
const key = { email: email.toLowerCase() };
const attempts = (await failures.get(key)) ?? 0;
if (attempts >= MAX_FAILURES) throw APIError.resourceExhausted("too many failed attempts, try again later");
// Replace with a real credential check.
if (password !== "correct horse") {
await failures.increment(key, 1);
throw APIError.unauthenticated("invalid credentials");
}
const token = randomBytes(24).toString("hex");
await sessions.set({ token }, { email: key.email, createdAt: new Date().toISOString() });
return { token };
},
);
export const me = api(
{ expose: true, method: "GET", path: "/me/:token" },
async ({ token }: { token: string }): Promise<{ email: string }> => {
const session = await sessions.get({ token });
if (!session) throw APIError.unauthenticated("session expired");
return { email: session.email };
},
);
encore run starts the app with the cache in memory, and curl is enough to see the throttle: five wrong passwords return unauthenticated and the sixth attempt returns resource_exhausted, even with the right password. Expiry applies the same way as on a managed cluster, so the session disappears after an hour. Restarting encore run clears the cache, which also removes the leftover-keys problem that a long-lived Docker container has. The caching docs cover keyspace types, expiry and eviction policies.
To deploy, connect your AWS or GCP account as described in Connect your cloud account and push, and the cluster is created in your account from the same declaration. When an AI coding agent adds a new cached lookup, the keyspace and the code that uses it are one change that it can run locally, with no container to start first.
Best fit: Teams that want a working Redis-style cache in development and the same code on ElastiCache or Memorystore in production.
Use Docker or Valkey in Docker when you need the actual server, for example to test a Lua script or an eviction edge case, and miniredis for fast Go unit tests. Use Encore when the cache is part of an application you also deploy, so the declaration, the local behavior and the managed cluster stay in step.
Docker is the most common: docker run -p 6379:6379 redis starts a server in a few seconds, and docker run -p 6379:6379 valkey/valkey does the same for Valkey. A native install through Homebrew or your package manager avoids Docker but leaves a service running on your machine.
Use whichever your production service runs. Valkey is the open source fork that ElastiCache and Memorystore both offer, it speaks the same protocol, and a client that works against one works against the other. Redis is available under the AGPLv3 license as well as other licenses, so licensing is the main reason teams pick between them.
Yes, with an in-process fake. In Go, miniredis starts a server inside the test process that implements many Redis commands over a real TCP interface. A fake does not cover every command or behavior, so integration tests against a actual server still matter for scripts and eviction.
With Encore you declare a cache cluster and keyspaces in the service code. encore run uses an in-memory Redis implementation locally, so no container is needed, and deploying to your AWS account provisions ElastiCache for the same declaration, or Memorystore on GCP.
Deploy to your cloud on AWS and Google Cloud without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.