@fluojs/cache-manager 1.0.0-beta.2 → 1.0.0-beta.4

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
@@ -125,7 +125,9 @@ Redis reset 소유권은 기본값이 `fluo:cache:`인 `keyPrefix`로 제한됩
125
125
 
126
126
  ### 쿼리 매개변수 기반 캐싱
127
127
 
128
- 기본적으로 캐시 키는 쿼리 매개변수를 무시합니다. 검색 조건 등에 따라 다른 응답을 캐싱하려면 `httpKeyStrategy: 'route+query'`를 활성화하세요.
128
+ 내장 HTTP 캐시 전략은 경로 부분을 route template metadata가 아니라 구체적인 요청 경로(`requestContext.request.path`)에서 계산합니다. 따라서 같은 `@Get('/:id')` 핸들러를 타더라도 `/users/1`과 `/users/2` 같은 요청은 항상 서로 다른 캐시 키로 분리됩니다.
129
+
130
+ 기본적으로 캐시 키는 쿼리 매개변수를 무시하고 구체적인 요청 경로만 사용합니다. 검색 조건 등에 따라 다른 응답을 캐싱하려면 `httpKeyStrategy: 'route+query'`를 활성화하세요. 내장 전략에서는 `full`도 동일하게 query-aware 키를 만듭니다.
129
131
 
130
132
  ```typescript
131
133
  CacheModule.forRoot({
package/README.md CHANGED
@@ -125,7 +125,9 @@ Redis reset ownership is scoped by `keyPrefix`, which defaults to `fluo:cache:`.
125
125
 
126
126
  ### Query-Sensitive Caching
127
127
 
128
- By default, the cache key ignores query parameters. Enable `httpKeyStrategy: 'route+query'` to cache different responses for different search parameters.
128
+ Built-in HTTP cache key strategies derive their path segment from the concrete request path (`requestContext.request.path`), not the route template metadata. That means requests such as `/users/1` and `/users/2` always resolve to different cache keys even when they hit the same `@Get('/:id')` handler.
129
+
130
+ By default, the cache key ignores query parameters and uses only the concrete request path. Enable `httpKeyStrategy: 'route+query'` (or `full`, which is equivalent for the built-in strategy set) to cache different responses for different search parameters.
129
131
 
130
132
  ```typescript
131
133
  CacheModule.forRoot({
package/dist/clone.d.ts CHANGED
@@ -1,2 +1,8 @@
1
+ /**
2
+ * Clone cache value.
3
+ *
4
+ * @param value The value.
5
+ * @returns The clone cache value result.
6
+ */
1
7
  export declare function cloneCacheValue<T>(value: T): T;
2
8
  //# sourceMappingURL=clone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../src/clone.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE9C"}
1
+ {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../src/clone.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE9C"}
package/dist/clone.js CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Clone cache value.
3
+ *
4
+ * @param value The value.
5
+ * @returns The clone cache value result.
6
+ */
1
7
  export function cloneCacheValue(value) {
2
8
  return structuredClone(value);
3
9
  }
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
5
5
  function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
6
6
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
7
7
  import { Inject } from '@fluojs/core';
8
- import { metadataSymbol } from '@fluojs/core/internal';
8
+ import { getStandardMetadataBag } from '@fluojs/core/internal';
9
9
  import { SseResponse } from '@fluojs/http';
10
10
  import { cacheRouteMetadataKey, getCacheEvictMetadata, getCacheKeyMetadata, getCacheTtlMetadata } from './decorators.js';
11
11
  import { CacheService } from './service.js';
@@ -14,7 +14,7 @@ function isMetadataBag(value) {
14
14
  return typeof value === 'object' && value !== null;
15
15
  }
16
16
  function getMethodMetadataBag(controllerToken, methodName) {
17
- const classBag = Reflect.get(controllerToken, metadataSymbol);
17
+ const classBag = getStandardMetadataBag(controllerToken);
18
18
  if (!isMetadataBag(classBag)) {
19
19
  return undefined;
20
20
  }
@@ -54,7 +54,7 @@ function defaultCacheKey(context, strategy, resolver) {
54
54
  if (typeof strategy === 'function') {
55
55
  return strategy(context);
56
56
  }
57
- const path = context.handler.metadata.effectivePath;
57
+ const path = context.requestContext.request.path;
58
58
  const query = context.requestContext.request.query;
59
59
  if (strategy === 'route') {
60
60
  return appendPrincipalScope(path, context, resolver);
@@ -1,4 +1,7 @@
1
1
  import type { CacheStore } from '../types.js';
2
+ /**
3
+ * Represents the memory store.
4
+ */
2
5
  export declare class MemoryStore implements CacheStore {
3
6
  private readonly entries;
4
7
  private nextSweepAt;
@@ -1 +1 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/stores/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAyC9C,qBAAa,WAAY,YAAW,UAAU;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,WAAW,CAAK;IAElB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAsBrD,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBtE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
1
+ {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../src/stores/memory-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAyC9C;;GAEG;AACH,qBAAa,WAAY,YAAW,UAAU;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,WAAW,CAAK;IAElB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAsBrD,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBtE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
@@ -23,6 +23,10 @@ function enforceEntryLimit(entries) {
23
23
  entries.delete(oldestKey);
24
24
  }
25
25
  }
26
+
27
+ /**
28
+ * Represents the memory store.
29
+ */
26
30
  export class MemoryStore {
27
31
  entries = new Map();
28
32
  nextSweepAt = 0;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "memory-store",
11
11
  "decorator"
12
12
  ],
13
- "version": "1.0.0-beta.2",
13
+ "version": "1.0.0-beta.4",
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/di": "^1.0.0-beta.2",
41
- "@fluojs/core": "^1.0.0-beta.1",
42
- "@fluojs/http": "^1.0.0-beta.1",
43
- "@fluojs/runtime": "^1.0.0-beta.2"
40
+ "@fluojs/core": "^1.0.0-beta.2",
41
+ "@fluojs/di": "^1.0.0-beta.4",
42
+ "@fluojs/http": "^1.0.0-beta.3",
43
+ "@fluojs/runtime": "^1.0.0-beta.4"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "ioredis": "^5.0.0",