Cacheable

High-performance layer 1 / layer 2 caching engine built on Keyv

Library
npm
v2.5.0
2,013 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
88 /100 Excellent
Development Activity 100
Maintenance 84
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
79 /100 Good
Architecture 80
Code Quality 82
Innovation 75
Learning Curve 78

Cacheable is a distributed caching library for Node.js built on top of the Keyv storage engine, providing simple layered (memory + remote) caching with an enterprise-grade feature set. It combines an in-memory LRU cache (CacheableMemory) as a fast primary layer with any Keyv-compatible secondary store (Redis, etc.), non-blocking writes, and a CacheSync pub/sub mechanism for keeping multiple instances consistent.

Part of the broader jaredwray/cacheable monorepo (which also ships cache-manager, cacheable-request, flat-cache, and other caching utilities), Cacheable is under active, regular maintenance with comprehensive test coverage and both ESM and CommonJS builds.

What You Get

  • Cacheable class combining a fast in-memory primary store with an optional remote secondary store
  • CacheableMemory - a standalone LRU cache with TTL/expiration support
  • Function memoization via wrap() and getOrSet() with stampede protection for sync and async functions
  • Hooks and events (before/after set, get, delete) to extend caching behavior
  • CacheSync for distributed cache invalidation across instances via pub/sub
  • Non-blocking secondary-store writes so remote latency doesn’t block reads/writes

Common Use Cases

  • Adding a fast in-memory layer in front of Redis to cut round-trips for hot keys
  • Memoizing expensive async function calls (e.g. DB queries) with automatic TTL
  • Keeping cache state consistent across multiple app instances via CacheSync
  • Tag-based invalidation of related cache entries after a data update
  • Building a resilient caching layer that degrades gracefully if the remote store is offline

Under The Hood

Architecture - The packages/cacheable module (within the jaredwray/cacheable pnpm monorepo) centers on a Cacheable class in src/index.ts that composes a primary Keyv instance (defaulting to CacheableMemory, an in-memory LRU store defined in src/memory.ts equivalents) with an optional secondary Keyv-compatible store; reads check primary then fall back to secondary, writes propagate to both non-blockingly, and sync.ts implements CacheSync, a pub/sub layer that broadcasts invalidations to keep multiple processes’ primary caches consistent.

Tech Stack - Written in TypeScript (97%+ of the monorepo), built with tsdown to emit both ESM (.mjs) and CommonJS (.cjs) outputs with generated .d.ts types, and depends on the keyv storage-adapter ecosystem (@keyv/redis, lru-cache) rather than hardcoding a specific backend, using pnpm workspaces to share tooling (biome for linting) across the monorepo’s ten-plus packages.

Code Quality - The monorepo enforces test coverage via Codecov badges and a GitHub Actions tests.yml workflow; the cacheable package itself is a relatively small, focused module (~2,200 lines across src/), and the monorepo’s shared CONTRIBUTING.md/AGENTS.md/CLAUDE.md files indicate deliberate conventions for contributors and AI coding agents alike.

API Design - The API is intentionally minimal - new Cacheable({secondary}) plus .get()/.set()/.delete() covers the common case, with TTL shorthand strings ('1h', '1d') reducing boilerplate, and wrap()/getOrSet() let existing functions be memoized without restructuring calling code; hooks and typed events provide an escape hatch for advanced use without complicating the base API.

Used by 14 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,661

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
65
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 2 months ago
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

4,080

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
91
Repo Health
77
Technical
61
Dependency
Built with
TypeScript 97%
Updated 1 weeks ago
TypeScript
96%
AGPL 3.0

Docmost

CMS · Collaboration · Note Taking

22,250

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
66
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
64%
MIT

Ghost

Blogging · CMS

55,701

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
64
Dependency
Built with
TypeScript 64%
JavaScript 33%
Updated 1 weeks ago
TypeScript
98%
Other

Hexabot

AI Development · Automation

1,155

Build and run agentic workflows across channels with YAML, tools, and RAG

View details
80
Repo Health
76
Technical
65
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
TypeScript
98%
Other

Hexabot

AI Development · Automation

1,155

Build and run agentic workflows across channels with YAML, tools, and RAG

View details
80
Repo Health
76
Technical
65
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,386

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
74
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 3 weeks ago
TypeScript
98%
Other

Kibana

Analytics · Monitoring

21,355

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
TypeScript
94%
AGPL 3.0

Laudspeaker

Automation · Marketing

2,631

Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.

View details
44
Repo Health
66
Technical
62
Dependency
Built with
TypeScript 94%
Updated 4 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers