This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is node-ts-cache, a TypeScript/Node.js caching library featuring:
- Decorator-based caching (@Cache, @SyncCache, @MultiCache)
- Multiple storage backends (Memory, File System, Redis, LRU, etc.)
- Flexible expiration strategies (TTL-based with lazy/eager invalidation)
It's a monorepo using Lerna with independent versioning.
npm run build # Build all packagesnpm test # Run all tests across all packagesnpm run lint # Run ESLint on all source files
npm run lint:fix # Run ESLint with auto-fixnpm run format # Check formatting with Prettier
npm run format:fix # Fix formatting with PrettierAlways run these checks before committing:
npm run lint- Ensure no linting errorsnpm run format- Ensure code is properly formattednpm test- Ensure all tests passnpm run build- Ensure the project builds successfully
├── ts-cache/ # Core caching package (@node-ts-cache/core)
│ ├── src/
│ │ ├── decorator/ # @Cache, @SyncCache, @MultiCache decorators
│ │ ├── storage/ # MemoryStorage, FsJsonStorage
│ │ ├── strategy/ # ExpirationStrategy, key strategies
│ │ └── types/ # TypeScript interfaces
│ └── test/ # Test files
├── storages/ # Storage adapter packages
│ ├── lru/ # LRU cache storage
│ ├── redis/ # Redis storage (redis package v4.x)
│ ├── redisio/ # Redis storage (ioredis with compression)
│ ├── node-cache/ # node-cache storage
│ └── lru-redis/ # Two-tier LRU + Redis storage
- Uses Vitest
- Tests use Node's built-in
assertmodule - Mock Redis instances using
redis-mockandioredis-mock