@keq-request/cache 5.0.0-alpha.34 → 5.0.0-alpha.35
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/CHANGELOG.md +11 -0
- package/dist/index.d.mts +354 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +352 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1211 -1276
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1183 -1251
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/tsdown.config.ts +12 -0
- package/dist/cache-entry/cache-entry.d.ts +0 -17
- package/dist/cache-entry/cache-entry.d.ts.map +0 -1
- package/dist/cache-entry/index.d.ts +0 -4
- package/dist/cache-entry/index.d.ts.map +0 -1
- package/dist/cache-entry/types/cache-entry-build-options.d.ts +0 -8
- package/dist/cache-entry/types/cache-entry-build-options.d.ts.map +0 -1
- package/dist/cache-entry/types/cache-entry-options.d.ts +0 -7
- package/dist/cache-entry/types/cache-entry-options.d.ts.map +0 -1
- package/dist/cache.d.ts +0 -44
- package/dist/cache.d.ts.map +0 -1
- package/dist/constants/eviction.enum.d.ts +0 -7
- package/dist/constants/eviction.enum.d.ts.map +0 -1
- package/dist/constants/index.d.ts +0 -5
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/max-expired-at.d.ts +0 -2
- package/dist/constants/max-expired-at.d.ts.map +0 -1
- package/dist/constants/size.enum.d.ts +0 -7
- package/dist/constants/size.enum.d.ts.map +0 -1
- package/dist/constants/strategy.enum.d.ts +0 -7
- package/dist/constants/strategy.enum.d.ts.map +0 -1
- package/dist/exceptions/cache-exception.d.ts +0 -5
- package/dist/exceptions/cache-exception.d.ts.map +0 -1
- package/dist/exceptions/index.d.ts +0 -2
- package/dist/exceptions/index.d.ts.map +0 -1
- package/dist/request-cache-handler/index.d.ts +0 -2
- package/dist/request-cache-handler/index.d.ts.map +0 -1
- package/dist/request-cache-handler/request-cache-handler.d.ts +0 -24
- package/dist/request-cache-handler/request-cache-handler.d.ts.map +0 -1
- package/dist/storage/index.d.ts +0 -6
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts +0 -22
- package/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/constants/default-table-name.d.ts +0 -2
- package/dist/storage/indexed-db-storage/constants/default-table-name.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/index.d.ts +0 -3
- package/dist/storage/indexed-db-storage/index.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/indexed-db-storage.d.ts +0 -12
- package/dist/storage/indexed-db-storage/indexed-db-storage.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts +0 -11
- package/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts +0 -11
- package/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts +0 -11
- package/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts +0 -11
- package/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/index.d.ts +0 -7
- package/dist/storage/indexed-db-storage/types/index.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts +0 -12
- package/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts +0 -8
- package/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts +0 -14
- package/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts +0 -29
- package/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts +0 -14
- package/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts.map +0 -1
- package/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts +0 -13
- package/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts.map +0 -1
- package/dist/storage/internal-storage/internal-storage.d.ts +0 -16
- package/dist/storage/internal-storage/internal-storage.d.ts.map +0 -1
- package/dist/storage/internal-storage/types/events.d.ts +0 -16
- package/dist/storage/internal-storage/types/events.d.ts.map +0 -1
- package/dist/storage/internal-storage/types/storage-options.d.ts +0 -20
- package/dist/storage/internal-storage/types/storage-options.d.ts.map +0 -1
- package/dist/storage/keq-cache-storage.d.ts +0 -20
- package/dist/storage/keq-cache-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/base-memory-storage.d.ts +0 -31
- package/dist/storage/memory-storage/base-memory-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/index.d.ts +0 -3
- package/dist/storage/memory-storage/index.d.ts.map +0 -1
- package/dist/storage/memory-storage/lfu-memory-storage.d.ts +0 -11
- package/dist/storage/memory-storage/lfu-memory-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/lru-memory-storage.d.ts +0 -11
- package/dist/storage/memory-storage/lru-memory-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/memory-storage.d.ts +0 -13
- package/dist/storage/memory-storage/memory-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/random-memory-storage.d.ts +0 -11
- package/dist/storage/memory-storage/random-memory-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/ttl-memory-storage.d.ts +0 -11
- package/dist/storage/memory-storage/ttl-memory-storage.d.ts.map +0 -1
- package/dist/storage/memory-storage/types/index.d.ts +0 -3
- package/dist/storage/memory-storage/types/index.d.ts.map +0 -1
- package/dist/storage/memory-storage/types/memory-storage-options.d.ts +0 -9
- package/dist/storage/memory-storage/types/memory-storage-options.d.ts.map +0 -1
- package/dist/storage/memory-storage/types/memory-storage-size.d.ts +0 -13
- package/dist/storage/memory-storage/types/memory-storage-size.d.ts.map +0 -1
- package/dist/storage/memory-storage/utils/humanize-size.d.ts +0 -6
- package/dist/storage/memory-storage/utils/humanize-size.d.ts.map +0 -1
- package/dist/storage/memory-storage/utils/index.d.ts +0 -3
- package/dist/storage/memory-storage/utils/index.d.ts.map +0 -1
- package/dist/storage/memory-storage/utils/serialize-response-body.d.ts +0 -6
- package/dist/storage/memory-storage/utils/serialize-response-body.d.ts.map +0 -1
- package/dist/storage/multi-tier-storage/index.d.ts +0 -3
- package/dist/storage/multi-tier-storage/index.d.ts.map +0 -1
- package/dist/storage/multi-tier-storage/multi-tier-storage.d.ts +0 -36
- package/dist/storage/multi-tier-storage/multi-tier-storage.d.ts.map +0 -1
- package/dist/storage/multi-tier-storage/types/index.d.ts +0 -2
- package/dist/storage/multi-tier-storage/types/index.d.ts.map +0 -1
- package/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts +0 -5
- package/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts.map +0 -1
- package/dist/storage/tier-storage/index.d.ts +0 -3
- package/dist/storage/tier-storage/index.d.ts.map +0 -1
- package/dist/storage/tier-storage/tier-storage.d.ts +0 -15
- package/dist/storage/tier-storage/tier-storage.d.ts.map +0 -1
- package/dist/storage/tier-storage/types/index.d.ts +0 -2
- package/dist/storage/tier-storage/types/index.d.ts.map +0 -1
- package/dist/storage/tier-storage/types/tier-storage-options.d.ts +0 -21
- package/dist/storage/tier-storage/types/tier-storage-options.d.ts.map +0 -1
- package/dist/strategies/cache-first.d.ts +0 -3
- package/dist/strategies/cache-first.d.ts.map +0 -1
- package/dist/strategies/index.d.ts +0 -5
- package/dist/strategies/index.d.ts.map +0 -1
- package/dist/strategies/network-first.d.ts +0 -3
- package/dist/strategies/network-first.d.ts.map +0 -1
- package/dist/strategies/network-only.d.ts +0 -3
- package/dist/strategies/network-only.d.ts.map +0 -1
- package/dist/strategies/stale-while-revalidate.d.ts +0 -3
- package/dist/strategies/stale-while-revalidate.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/keq-cache-key.d.ts +0 -4
- package/dist/types/keq-cache-key.d.ts.map +0 -1
- package/dist/types/keq-cache-pattern.d.ts +0 -3
- package/dist/types/keq-cache-pattern.d.ts.map +0 -1
- package/dist/types/keq-cache-rule.d.ts +0 -6
- package/dist/types/keq-cache-rule.d.ts.map +0 -1
- package/dist/types/keq-cache-strategy.d.ts +0 -6
- package/dist/types/keq-cache-strategy.d.ts.map +0 -1
- package/dist/types/request-cache-options.d.ts +0 -45
- package/dist/types/request-cache-options.d.ts.map +0 -1
- package/dist/utils/get-response-bytes.d.ts +0 -2
- package/dist/utils/get-response-bytes.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -5
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/random.d.ts +0 -2
- package/dist/utils/random.d.ts.map +0 -1
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface MemoryStorageSize {
|
|
2
|
-
/**
|
|
3
|
-
* @en The size of the used storage
|
|
4
|
-
* @zh 已使用的Storage大小
|
|
5
|
-
*/
|
|
6
|
-
used: number;
|
|
7
|
-
/**
|
|
8
|
-
* @en The size of the free storage
|
|
9
|
-
* @zh 剩余的Storage大小
|
|
10
|
-
*/
|
|
11
|
-
free: number;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=memory-storage-size.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory-storage-size.d.ts","sourceRoot":"","sources":["../../../../src/storage/memory-storage/types/memory-storage-size.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"humanize-size.d.ts","sourceRoot":"","sources":["../../../../src/storage/memory-storage/utils/humanize-size.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/memory-storage/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-response-body.d.ts","sourceRoot":"","sources":["../../../../src/storage/memory-storage/utils/serialize-response-body.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB/E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/multi-tier-storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CacheEntry } from '../../cache-entry/cache-entry.js';
|
|
2
|
-
import { KeqCacheStorage } from '../keq-cache-storage.js';
|
|
3
|
-
import { MultiTierStorageOptions } from './types/multi-tier-storage-options.js';
|
|
4
|
-
/**
|
|
5
|
-
* @en Multi-tier cache storage that manages multiple KeqCacheStorage instances in tiers
|
|
6
|
-
* @zh 多层缓存存储,管理多个分层的 KeqCacheStorage 实例
|
|
7
|
-
*/
|
|
8
|
-
export declare class MultiTierStorage extends KeqCacheStorage {
|
|
9
|
-
private readonly storages;
|
|
10
|
-
/**
|
|
11
|
-
* @param storages Array of storage instances ordered by performance (fastest first)
|
|
12
|
-
* @zh 按性价比排序的存储实例数组,排在前面的成本低,排在后面的成本高
|
|
13
|
-
*/
|
|
14
|
-
constructor(options: MultiTierStorageOptions);
|
|
15
|
-
/**
|
|
16
|
-
* @en Get cache entry, searching from lowest to highest tier
|
|
17
|
-
* @zh 获取缓存条目,从最底层到高层依次搜索
|
|
18
|
-
*/
|
|
19
|
-
get(key: string): Promise<CacheEntry | undefined>;
|
|
20
|
-
/**
|
|
21
|
-
* @en Set cache entry to all tiers concurrently
|
|
22
|
-
* @zh 并发写入所有层的缓存
|
|
23
|
-
*/
|
|
24
|
-
set(entry: CacheEntry): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* @en Remove cache entry from all tiers
|
|
27
|
-
* @zh 从所有层删除缓存条目
|
|
28
|
-
*/
|
|
29
|
-
remove(key: string): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* @en Sync cache entry to all lower tiers (tiers with index < currentTierIndex)
|
|
32
|
-
* @zh 将缓存条目同步到所有低层存储(索引小于当前层的存储)
|
|
33
|
-
*/
|
|
34
|
-
private syncToLowerTiers;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=multi-tier-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-tier-storage.d.ts","sourceRoot":"","sources":["../../../src/storage/multi-tier-storage/multi-tier-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAE/E;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAE5C;;;OAGG;gBACS,OAAO,EAAE,uBAAuB;IAU5C;;;OAGG;IACG,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAkBvD;;;OAGG;IACG,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3C;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC;;;OAGG;YACW,gBAAgB;CAoB/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/multi-tier-storage/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-tier-storage-options.d.ts","sourceRoot":"","sources":["../../../../src/storage/multi-tier-storage/types/multi-tier-storage-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAEhE,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,eAAe,EAAE,CAAA;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/tier-storage/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { MultiTierStorage } from '../multi-tier-storage/multi-tier-storage.js';
|
|
2
|
-
import { TierStorageOptions } from './types/tier-storage-options.js';
|
|
3
|
-
/**
|
|
4
|
-
* @en Two-tier cache storage that combines MemoryStorage (L1) and IndexedDBStorage (L2)
|
|
5
|
-
* @zh 二级缓存存储,结合了MemoryStorage(一级)和IndexedDBStorage(二级)
|
|
6
|
-
*
|
|
7
|
-
* This is a convenience wrapper around MultiTierStorage that provides:
|
|
8
|
-
* - Fast in-memory cache (L1)
|
|
9
|
-
* - Persistent IndexedDB cache (L2)
|
|
10
|
-
* - Simplified configuration options
|
|
11
|
-
*/
|
|
12
|
-
export declare class TierStorage extends MultiTierStorage {
|
|
13
|
-
constructor(options?: TierStorageOptions);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=tier-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tier-storage.d.ts","sourceRoot":"","sources":["../../../src/storage/tier-storage/tier-storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAA;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,gBAAgB;gBACnC,OAAO,CAAC,EAAE,kBAAkB;CAezC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/tier-storage/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { MemoryStorageOptions } from '../../../storage/memory-storage/types/memory-storage-options.js';
|
|
2
|
-
import { IndexedDbStorageOptions } from '../../../storage/indexed-db-storage/types/indexed-db-storage-options.js';
|
|
3
|
-
import { MemoryStorage } from '../../../storage/memory-storage/memory-storage.js';
|
|
4
|
-
import { IndexedDBStorage } from '../../../storage/indexed-db-storage/indexed-db-storage.js';
|
|
5
|
-
/**
|
|
6
|
-
* @en Configuration options for TierStorage
|
|
7
|
-
* @zh TierStorage 的配置选项
|
|
8
|
-
*/
|
|
9
|
-
export interface TierStorageOptions {
|
|
10
|
-
/**
|
|
11
|
-
* @en Memory storage instance or options for the memory storage (L1 cache)
|
|
12
|
-
* @zh 内存存储实例或配置选项(一级缓存)
|
|
13
|
-
*/
|
|
14
|
-
memory?: MemoryStorage | MemoryStorageOptions;
|
|
15
|
-
/**
|
|
16
|
-
* @en IndexedDB storage instance or options for the IndexedDB storage (L2 cache)
|
|
17
|
-
* @zh IndexedDB 存储实例或配置选项(二级缓存)
|
|
18
|
-
*/
|
|
19
|
-
indexedDB?: IndexedDBStorage | IndexedDbStorageOptions;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=tier-storage-options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tier-storage-options.d.ts","sourceRoot":"","sources":["../../../../src/storage/tier-storage/types/tier-storage-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAA;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAA;AAC1G,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAA;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAA;AAErF;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,GAAG,oBAAoB,CAAA;IAE7C;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,GAAG,uBAAuB,CAAA;CACvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-first.d.ts","sourceRoot":"","sources":["../../src/strategies/cache-first.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAIhE,eAAO,MAAM,UAAU,EAAE,gBA6CxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/strategies/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network-first.d.ts","sourceRoot":"","sources":["../../src/strategies/network-first.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAIhE,eAAO,MAAM,YAAY,EAAE,gBA8C1B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network-only.d.ts","sourceRoot":"","sources":["../../src/strategies/network-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAGhE,eAAO,MAAM,WAAW,EAAE,gBAEzB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stale-while-revalidate.d.ts","sourceRoot":"","sources":["../../src/strategies/stale-while-revalidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAGhE,eAAO,MAAM,oBAAoB,EAAE,gBA6ElC,CAAA"}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq-cache-key.d.ts","sourceRoot":"","sources":["../../src/types/keq-cache-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAEhC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,KAAK,MAAM,CAAC,CAAA;AAClE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,kBAAkB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq-cache-pattern.d.ts","sourceRoot":"","sources":["../../src/types/keq-cache-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAGhC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,GAAG,IAAI,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq-cache-rule.d.ts","sourceRoot":"","sources":["../../src/types/keq-cache-rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAGxD,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { KeqExecutionContext, KeqNext } from 'keq';
|
|
2
|
-
import { RequestCacheHandler } from '../request-cache-handler';
|
|
3
|
-
export interface KeqCacheStrategy {
|
|
4
|
-
(handler: RequestCacheHandler, context: KeqExecutionContext, next: KeqNext): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=keq-cache-strategy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keq-cache-strategy.d.ts","sourceRoot":"","sources":["../../src/types/keq-cache-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAG7D,MAAM,WAAW,gBAAgB;IAC/B,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3F"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { KeqCacheStrategy, KeqCacheKey } from '../types/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* The options for a cacheable request.
|
|
4
|
-
*/
|
|
5
|
-
export interface RequestCacheOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Enable debug logs
|
|
8
|
-
*/
|
|
9
|
-
debug?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Enable Server-Timing header
|
|
12
|
-
*/
|
|
13
|
-
serverTiming?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* This configuration item controls whether requests are allowed to be concurrent.
|
|
16
|
-
* By default, concurrency is disabled
|
|
17
|
-
*
|
|
18
|
-
* When multiple requests with the same key occur,
|
|
19
|
-
* the subsequent ones are blocked until the previous request completes.
|
|
20
|
-
* This ensures that the cache is utilized effectively and prevents redundant processing for identical keys
|
|
21
|
-
*
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
concurrent?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Cache Key
|
|
27
|
-
*/
|
|
28
|
-
key?: KeqCacheKey;
|
|
29
|
-
/**
|
|
30
|
-
* @default Strategy.NETWORK_FIRST
|
|
31
|
-
*/
|
|
32
|
-
strategy: KeqCacheStrategy;
|
|
33
|
-
/**
|
|
34
|
-
* @en seconds
|
|
35
|
-
* @zh 秒
|
|
36
|
-
*
|
|
37
|
-
* @default Infinity
|
|
38
|
-
*/
|
|
39
|
-
ttl?: number;
|
|
40
|
-
/**
|
|
41
|
-
* If exclude is true, the request will not be cached.
|
|
42
|
-
*/
|
|
43
|
-
exclude?: (res: Response) => (Promise<boolean> | boolean);
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=request-cache-options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"request-cache-options.d.ts","sourceRoot":"","sources":["../../src/types/request-cache-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGhE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAGpB;;OAEG;IACH,GAAG,CAAC,EAAE,WAAW,CAAA;IAEjB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAA;IAE1B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAA;CAC1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-response-bytes.d.ts","sourceRoot":"","sources":["../../src/utils/get-response-bytes.ts"],"names":[],"mappings":"AAAA,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ1E"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,yBAAyB,CAAA"}
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM;IACjB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAItC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAGvC"}
|
package/dist/utils/random.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/utils/random.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|