This release adds 4 notable features for engineering teams evaluating rollout.
Published 2mo
Caching
✓ No known CVEs patched
✓ No known CVEs patched in this version
Topics
cache-manager
cache
memory-cache
multi-layer-cache
nodejs
redis
+2 more
stampede-prevention
typescript
Summary
AI summaryAdded exact-key invalidation, stale‑preserving expiration APIs with TypeScript JSDoc.
Full changelog
What's Changed
Added
- Added exact-key invalidation aliases:
invalidateByKey()andinvalidateByKeys(), mirroringdelete()andmdelete()while matching theinvalidateBy*API family. - Added exact-key stale-preserving expiration:
expireByKey()andexpireByKeys(), allowing specific keys to be marked stale without deleting their stale-while-revalidate / stale-if-error windows. - Added namespace exact-key APIs so
CacheNamespaceexposes the same exact-key invalidation and expiration helpers with namespace-scoped keys. - Added public TypeScript JSDoc descriptions across methods, options, metrics, layers, serializers, integrations, and helpers.
Changed
- Bumped the package version from
2.0.0to2.1.0. - Updated docs-web package metadata and the landing page version badge to
2.1.0. - Updated API documentation for exact-key invalidation aliases and stale-preserving expiration methods.
- Updated the docs playground to support and demonstrate the latest exact-key syntax.
- Refreshed the docs playground UI with clearer theme behavior, visible controls, copy fallback behavior, and a clearer editor/result layout.
Fixed
- Fixed the playground stale-while-revalidate examples so they use millisecond TTL options and demonstrate stale serving during background refresh before showing the refreshed value.
- Fixed light-mode playground controls and result panels readability after the docs UI refresh.
Verification
- Node.js 20 CI passed.
- Node.js 22 CI passed.
- Vercel preview passed.
- Coveralls passed.
Weekly OSS security release digest.
The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.
No spam, unsubscribe anytime.
Share this release
About flyingsquirrel0419/layercache
All releases →Related context
Earlier breaking changes
- v4.0.0 Write coordination applies finite default limits and can reject saturated work with CacheWriteSaturationError.
- v4.0.0 Automatically derived structured `wrap()` keys now use the `j2:` schema; old `j:` entries become cold misses and expire naturally.
- v4.0.0 Read-through fetchers now cache null as a regular value by default; `getOrThrow()` returns stored nulls while throwing only for undefined.
- v4.0.0 Public CacheStack reads now return undefined for misses and negative-cache entries instead of null.
Beta — feedback welcome: [email protected]