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.
| Name | module-cache-ts |
| Version | 0.1.0 |
| Category | composable-modules |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | cache, caching, redis, memcached, typescript |
| Source | templates/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
| Tool | Version | Why |
|---|---|---|
node | >=22 | Node.js runtime for the cache module |
Variables
Required
ProjectNamestring- Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.
Optional
Descriptionstring — defaults toPluggable caching layer with TTL and namespace support- Short project description for package.json and README
CacheProviderstring — defaults tomemory- 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.tsComposes with
- Pairs with
ts-service - Pairs with
agentic-loop - Pairs with
rag-pipeline - Nests inside
monorepo
Composites that use it
- Production API Service — Production-grade TypeScript API service with auth, database, caching, rate limiting, background jobs, observability, and deployment..