Overview
What this package owns in the runtime
Cache adds application-level data caching and client-facing HTTP cache control to xtaskjs. It registers named cache models, exposes injectable repositories and services, layers method decorators for cache read/write behavior, and can publish browser cache headers plus operational endpoints from the same package.
What it provides
- configureCache() centralizes default driver, TTL, namespace, Redis connection options, and shared HTTP cache defaults.
- CacheModel(), Cacheable(), CachePut(), and CacheEvict() cover model registration plus read-through, write-through, and eviction flows.
- CacheService, CacheRepository, and CacheAdminService are injectable for direct entry access, runtime inspection, and admin operations.
- BrowserCache(), CacheView(), NoStore(), NoCache(), VaryBy(), and HttpCacheService handle Cache-Control, ETag, Last-Modified, and Vary headers.
How it fits
- Initialized automatically by @xtaskjs/core when the package is installed and configureCache()/registerCacheModel() have been called.
- Supports in-memory stores by default and Redis-backed models when the redis client package is available.
- Demonstrated by the 12-cache_app, 13-cache_redis_app, 14-http_cache_web_app, and 15-fastify_http_cache_web_app samples.