Skip to content

Module: Pluggable Cache

Composable caching with pluggable backends. Ships with an in-memory provider for development, a Redis provider for distributed caching, and a Memcached provider for legacy infrastructure. Supports TTL, namespacing, and a cache-aside helper for read-through patterns.

Namemodule-cache-ts
Version0.1.0
Categorycomposable-modules
LicenseApache-2.0
Personaengineering
Tagscache, caching, redis, memcached, typescript
Sourcetemplates/module-cache-ts

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render module-cache-ts --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "module-cache-ts", variables);

# MCP — from an agent
get_template({ name: "module-cache-ts" })

Prerequisites

ToolVersionWhy
node>=22Node.js runtime for the cache module

Variables

Required

ProjectName string
Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to Pluggable caching layer with TTL and namespace support
Short project description for package.json and README
CacheProvider string — defaults to memory
Default cache provider (memory, redis, memcached, or a custom name)

What it produces

20 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.env.example
.gitignore
biome.json
package.json
README.md
src/cache/__tests__/memory.test.ts
src/cache/__tests__/registry.test.ts
src/cache/bootstrap.ts
src/cache/index.ts
src/cache/metrics.ts
src/cache/providers/index.ts
src/cache/providers/memcached.ts
src/cache/providers/memory.ts
src/cache/providers/redis.ts
src/cache/providers/registry.ts
src/cache/providers/types.ts
src/cache/types.ts
src/types/memjs.d.ts
tsconfig.json
vitest.config.ts

Composes with

Composites that use it

  • Production API Service — Production-grade TypeScript API service with auth, database, caching, rate limiting, background jobs, observability, and deployment..