@fluojs/cache-manager 1.0.0 → 1.0.2

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
@@ -186,7 +186,7 @@ defineModule(ManualCacheModule, {
186
186
 
187
187
  ### 지연 삭제 시점
188
188
 
189
- `@CacheEvict(...)`가 붙은 non-GET 핸들러는 응답이 성공적으로 commit된 뒤에 캐시를 삭제합니다. 어댑터 경로가 `response.send(...)`를 호출하지 않더라도, 인터셉터는 bounded fallback timer를 통해 성공한 쓰기 이후 stale 엔트리가 무기한 남지 않도록 보장합니다. 또한 지연 eviction 실패는 인터셉터 내부에 containment되어 cache key factory나 cache store 삭제 오류가 응답 이후 unhandled promise rejection으로 노출되지 않습니다.
189
+ `@CacheEvict(...)`가 붙은 non-GET 핸들러는 응답이 성공적으로 commit된 뒤에 캐시를 삭제합니다. `response.send(...)`가 reject되면 지연 eviction을 취소하여 실패한 commit이 이전 캐시된 읽기 결과를 삭제하지 않도록 합니다. 어댑터 경로가 `response.send(...)`를 호출하지 않더라도, 인터셉터는 bounded fallback timer를 통해 성공한 쓰기 이후 stale 엔트리가 무기한 남지 않도록 보장합니다. 또한 지연 eviction 실패는 인터셉터 내부에 containment되어 cache key factory나 cache store 삭제 오류가 응답 이후 unhandled promise rejection으로 노출되지 않습니다.
190
190
 
191
191
  ## 공개 API 개요
192
192
 
@@ -202,6 +202,7 @@ defineModule(ManualCacheModule, {
202
202
  - `@CacheTTL(seconds)`: 특정 핸들러의 TTL을 설정합니다.
203
203
  - `@CacheKey(key)`: 특정 핸들러의 custom cache key 또는 key factory를 설정합니다.
204
204
  - `@CacheEvict(key)`: 성공적인 non-GET 핸들러가 완료된 뒤 하나 이상의 cache key를 삭제합니다.
205
+ - `cacheRouteMetadataKey`, `getCacheKeyMetadata(...)`, `getCacheTtlMetadata(...)`, `getCacheEvictMetadata(...)`: 캐시 데코레이터 metadata key를 다시 구현하지 않고 cache decorator metadata를 검사해야 하는 first-party interceptor 통합, 진단, 고급 tooling을 위해 공개된 low-level metadata helper입니다.
205
206
 
206
207
  ### 인터셉터
207
208
  - `CacheInterceptor`: 자동 GET 응답 캐싱 및 삭제 로직을 처리합니다.
package/README.md CHANGED
@@ -186,7 +186,7 @@ The built-in memory store is designed for single-process, bounded caching:
186
186
 
187
187
  ### Deferred eviction timing
188
188
 
189
- For non-GET handlers decorated with `@CacheEvict(...)`, eviction is deferred until the response successfully commits. If an adapter path never calls `response.send(...)`, the interceptor still runs a bounded fallback timer so successful writes do not leave stale entries behind indefinitely. Deferred eviction failures stay contained inside the interceptor, so cache-key factories or cache-store deletes cannot surface as post-response unhandled promise rejections.
189
+ For non-GET handlers decorated with `@CacheEvict(...)`, eviction is deferred until the response successfully commits. If `response.send(...)` rejects, the deferred eviction is cancelled so a failed commit does not drop the previous cached read result. If an adapter path never calls `response.send(...)`, the interceptor still runs a bounded fallback timer so successful writes do not leave stale entries behind indefinitely. Deferred eviction failures stay contained inside the interceptor, so cache-key factories or cache-store deletes cannot surface as post-response unhandled promise rejections.
190
190
 
191
191
  ## Public API Overview
192
192
 
@@ -202,6 +202,7 @@ For non-GET handlers decorated with `@CacheEvict(...)`, eviction is deferred unt
202
202
  - `@CacheTTL(seconds)`: Sets the TTL for a specific handler.
203
203
  - `@CacheKey(key)`: Sets a custom cache key or key factory for a specific handler.
204
204
  - `@CacheEvict(key)`: Clears one or more cache keys after a successful non-GET handler completes.
205
+ - `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
206
 
206
207
  ### Interceptors
207
208
  - `CacheInterceptor`: Handles automatic GET response caching and eviction logic.
@@ -1 +1 @@
1
- {"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../src/interceptor.ts"],"names":[],"mappings":"AAEA,OAAO,EA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gBAAgB;YAkBV,OAAO;YAQP,OAAO;YAOP,OAAO;CAMtB"}
@@ -118,9 +118,15 @@ function installDeferredEviction(response, evict) {
118
118
  restore();
119
119
  }, EVICTION_FALLBACK_TIMEOUT_MS);
120
120
  response.send = async body => {
121
- await originalSend(body);
122
- runEviction();
123
- restore();
121
+ try {
122
+ await originalSend(body);
123
+ runEviction();
124
+ } catch (error) {
125
+ completed = true;
126
+ throw error;
127
+ } finally {
128
+ restore();
129
+ }
124
130
  };
125
131
  return restore;
126
132
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "memory-store",
11
11
  "decorator"
12
12
  ],
13
- "version": "1.0.0",
13
+ "version": "1.0.2",
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.0",
41
- "@fluojs/di": "^1.0.0",
40
+ "@fluojs/core": "^1.0.2",
41
+ "@fluojs/di": "^1.0.2",
42
42
  "@fluojs/http": "^1.0.0",
43
- "@fluojs/runtime": "^1.0.0"
43
+ "@fluojs/runtime": "^1.1.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "ioredis": "^5.0.0",