@fluojs/cache-manager 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md CHANGED
@@ -104,6 +104,7 @@ memory-only 소비자는 `@fluojs/redis`나 `ioredis`를 설치하지 않아도
104
104
  CacheModule.forRoot({
105
105
  store: 'redis',
106
106
  ttl: 600,
107
+ keyPrefix: 'myapp:cache:',
107
108
  })
108
109
  ```
109
110
 
@@ -124,7 +125,7 @@ CacheModule.forRoot({
124
125
 
125
126
  양수 Redis TTL 값은 초 단위로 받으며 소수도 허용됩니다. Redis `EX`는 정수 초를 사용하므로 Redis 만료 시간은 다음 정수 초로 올림하지만, fluo는 저장된 엔트리 안에 밀리초 정밀도의 만료 timestamp도 기록하고 해당 timestamp에 도달하면 값을 만료된 것으로 처리합니다. Redis 만료를 의도적으로 사용하지 않으려면 `ttl: 0`을 사용하세요.
126
127
 
127
- Redis reset 소유권은 기본값이 `fluo:cache:`인 `keyPrefix`로 제한됩니다. Redis 기반 저장소에서 `CacheService.reset()`은 해당 prefix 아래의 키만 삭제하므로, cache prefix 밖의 애플리케이션 소유 Redis 데이터는 유지됩니다. 의도적으로 빈 `keyPrefix`를 설정하면 reset은 `*`를 scan하지 않고 현재 `RedisStore` 인스턴스가 쓴 키로만 제한됩니다. 재시작 이후나 여러 프로세스에 걸친 캐시 엔트리까지 reset해야 한다면 비어 있지 않은 애플리케이션 전용 prefix를 사용하세요.
128
+ Redis reset 소유권은 기본값이 `fluo:cache:`이며 내장 `RedisStore` namespace로 전달되는 top-level `keyPrefix` 옵션으로 제한됩니다. Redis 기반 저장소에서 `CacheService.reset()`은 해당 prefix 아래의 키만 삭제하므로, cache prefix 밖의 애플리케이션 소유 Redis 데이터는 유지됩니다. 의도적으로 빈 `keyPrefix`를 설정하면 reset은 `*`를 scan하지 않고 현재 `RedisStore` 인스턴스가 쓴 키로만 제한됩니다. 재시작 이후나 여러 프로세스에 걸친 캐시 엔트리까지 reset해야 한다면 비어 있지 않은 애플리케이션 전용 prefix를 사용하세요.
128
129
 
129
130
  ### 쿼리 매개변수 기반 캐싱
130
131
 
@@ -191,17 +192,18 @@ defineModule(ManualCacheModule, {
191
192
  ## 공개 API 개요
192
193
 
193
194
  ### 모듈
194
- - `CacheModule.forRoot(options)`: 캐시 저장소(memory/redis/custom), 기본 TTL, 키 전략, `global`, `principalScopeResolver`, `redis.scanCount` 같은 Redis 옵션을 설정합니다.
195
+ - `CacheModule.forRoot(options)`: 캐시 저장소(memory/redis/custom), 기본 TTL, 키 전략, `global`, `principalScopeResolver`, Redis namespace `keyPrefix`, `redis.scanCount` 같은 Redis 옵션을 설정합니다.
195
196
  애플리케이션 모듈에서 사용하는 기본 패키지 진입점입니다.
196
197
 
197
198
 
198
199
  ### 서비스
199
- - `CacheService`: 수동 캐시 작업(`get`, `set`, `del`, `remember`, `reset`, `close`)을 위한 기본 API입니다.
200
+ - `CacheService`: 수동 캐시 작업(`get`, `set`, `del`, `remember`, `reset`, `close`)을 위한 기본 API입니다. 애플리케이션 shutdown은 같은 `close()` 경로를 호출하며, 이 경로는 `close()` 또는 `dispose()`를 노출하는 custom store로 teardown을 전달합니다.
200
201
 
201
202
  ### 데코레이터
202
203
  - `@CacheTTL(seconds)`: 특정 핸들러의 TTL을 설정합니다.
203
204
  - `@CacheKey(key)`: 특정 핸들러의 custom cache key 또는 key factory를 설정합니다.
204
205
  - `@CacheEvict(key)`: 성공적인 non-GET 핸들러가 완료된 뒤 하나 이상의 cache key를 삭제합니다.
206
+ - `cacheRouteMetadataKey`, `getCacheKeyMetadata(...)`, `getCacheTtlMetadata(...)`, `getCacheEvictMetadata(...)`: 캐시 데코레이터 metadata key를 다시 구현하지 않고 cache decorator metadata를 검사해야 하는 first-party interceptor 통합, 진단, 고급 tooling을 위해 공개된 low-level metadata helper입니다.
205
207
 
206
208
  ### 인터셉터
207
209
  - `CacheInterceptor`: 자동 GET 응답 캐싱 및 삭제 로직을 처리합니다.
package/README.md CHANGED
@@ -104,6 +104,7 @@ Memory-only consumers can keep importing from `@fluojs/cache-manager` without in
104
104
  CacheModule.forRoot({
105
105
  store: 'redis',
106
106
  ttl: 600,
107
+ keyPrefix: 'myapp:cache:',
107
108
  })
108
109
  ```
109
110
 
@@ -124,7 +125,7 @@ The built-in `RedisStore` persists entries with `JSON.stringify(...)`. Cache val
124
125
 
125
126
  Positive Redis TTL values are accepted in seconds and may be fractional. Redis expiry is rounded up to the next whole second because Redis `EX` uses integer seconds, while fluo also records the millisecond-precision expiry timestamp in the stored entry and treats the value as expired once that timestamp is reached. Use `ttl: 0` when you intentionally want no Redis expiry.
126
127
 
127
- Redis reset ownership is scoped by `keyPrefix`, which defaults to `fluo:cache:`. `CacheService.reset()` deletes only keys under that prefix for Redis-backed stores, so application-owned Redis data outside the cache prefix is preserved. If you intentionally configure an empty `keyPrefix`, reset is limited to keys written by the current `RedisStore` instance instead of scanning `*`; use a non-empty, application-specific prefix when you need reset to cover cache entries across restarts or multiple processes.
128
+ Redis reset ownership is scoped by the top-level `keyPrefix` option, which defaults to `fluo:cache:` and is passed through to the built-in `RedisStore` namespace. `CacheService.reset()` deletes only keys under that prefix for Redis-backed stores, so application-owned Redis data outside the cache prefix is preserved. If you intentionally configure an empty `keyPrefix`, reset is limited to keys written by the current `RedisStore` instance instead of scanning `*`; use a non-empty, application-specific prefix when you need reset to cover cache entries across restarts or multiple processes.
128
129
 
129
130
  ### Query-Sensitive Caching
130
131
 
@@ -191,17 +192,18 @@ For non-GET handlers decorated with `@CacheEvict(...)`, eviction is deferred unt
191
192
  ## Public API Overview
192
193
 
193
194
  ### Modules
194
- - `CacheModule.forRoot(options)`: Configures the cache store (memory/redis/custom), default TTL, key strategies, `global`, `principalScopeResolver`, and Redis options such as `redis.scanCount`.
195
+ - `CacheModule.forRoot(options)`: Configures the cache store (memory/redis/custom), default TTL, key strategies, `global`, `principalScopeResolver`, the Redis namespace `keyPrefix`, and Redis options such as `redis.scanCount`.
195
196
  This is the primary package entrypoint for application modules.
196
197
 
197
198
 
198
199
  ### Services
199
- - `CacheService`: Main API for manual cache operations (`get`, `set`, `del`, `remember`, `reset`, `close`).
200
+ - `CacheService`: Main API for manual cache operations (`get`, `set`, `del`, `remember`, `reset`, `close`). Application shutdown calls the same `close()` path, which forwards teardown to custom stores exposing `close()` or `dispose()`.
200
201
 
201
202
  ### Decorators
202
203
  - `@CacheTTL(seconds)`: Sets the TTL for a specific handler.
203
204
  - `@CacheKey(key)`: Sets a custom cache key or key factory for a specific handler.
204
205
  - `@CacheEvict(key)`: Clears one or more cache keys after a successful non-GET handler completes.
206
+ - `cacheRouteMetadataKey`, `getCacheKeyMetadata(...)`, `getCacheTtlMetadata(...)`, and `getCacheEvictMetadata(...)`: Low-level metadata helpers exported for first-party interceptor integration, diagnostics, and advanced tooling that needs to inspect cache decorator metadata without reimplementing the metadata keys.
205
207
 
206
208
  ### Interceptors
207
209
  - `CacheInterceptor`: Handles automatic GET response caching and eviction logic.
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "memory-store",
11
11
  "decorator"
12
12
  ],
13
- "version": "1.0.1",
13
+ "version": "1.0.3",
14
14
  "private": false,
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -37,10 +37,10 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@fluojs/core": "^1.0.1",
41
- "@fluojs/http": "^1.0.0",
42
- "@fluojs/runtime": "^1.0.1",
43
- "@fluojs/di": "^1.0.1"
40
+ "@fluojs/core": "^1.0.3",
41
+ "@fluojs/di": "^1.0.3",
42
+ "@fluojs/http": "^1.1.0",
43
+ "@fluojs/runtime": "^1.1.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "ioredis": "^5.0.0",