Skip to content

Memory Adapter

The Memory adapter is built into @express-route-cache/core and is perfect for single-process applications or local development.

Setup

ts
import { createCache, createMemoryAdapter } from "@express-route-cache/core";

const cache = createCache({
  adapter: createMemoryAdapter(),
});

Options

OptionTypeDefaultDescription
fallbackTTLnumber600Strict TTL in seconds to prevent memory leaks if items are never accessed.

Limitations

  • Process Local: Cache is not shared between multiple Node.js instances (e.g., in a cluster or Kubernetes).
  • Volatile: Cache is cleared whenever the server restarts.

Released under the MIT License.