@hazeljs/cache 0.2.0-beta.1 → 0.2.0-beta.8

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.
@@ -1,180 +0,0 @@
1
- /**
2
- * Cache strategy types
3
- */
4
- export type CacheStrategy = 'memory' | 'redis' | 'multi-tier';
5
- /**
6
- * TTL strategy types
7
- */
8
- export type TTLStrategy = 'absolute' | 'sliding';
9
- /**
10
- * Cache options
11
- */
12
- export interface CacheOptions {
13
- /**
14
- * Cache strategy to use
15
- * @default 'memory'
16
- */
17
- strategy?: CacheStrategy;
18
- /**
19
- * Time to live in seconds
20
- * @default 3600
21
- */
22
- ttl?: number;
23
- /**
24
- * TTL strategy
25
- * @default 'absolute'
26
- */
27
- ttlStrategy?: TTLStrategy;
28
- /**
29
- * Cache key pattern (supports placeholders like {id}, {userId})
30
- */
31
- key?: string;
32
- /**
33
- * Tags for group invalidation
34
- */
35
- tags?: string[];
36
- /**
37
- * Events that should invalidate this cache
38
- */
39
- invalidateOn?: string[];
40
- /**
41
- * Whether to cache null/undefined values
42
- * @default false
43
- */
44
- cacheNull?: boolean;
45
- /**
46
- * Custom condition function to determine if value should be cached
47
- */
48
- condition?: (value: unknown) => boolean;
49
- }
50
- /**
51
- * Cache entry metadata
52
- */
53
- export interface CacheEntry<T = unknown> {
54
- /**
55
- * Cached value
56
- */
57
- value: T;
58
- /**
59
- * Timestamp when cached
60
- */
61
- cachedAt: number;
62
- /**
63
- * Expiration timestamp
64
- */
65
- expiresAt: number;
66
- /**
67
- * Last accessed timestamp (for sliding TTL)
68
- */
69
- lastAccessedAt?: number;
70
- /**
71
- * Cache tags
72
- */
73
- tags?: string[];
74
- /**
75
- * Cache key
76
- */
77
- key: string;
78
- }
79
- /**
80
- * Cache statistics
81
- */
82
- export interface CacheStats {
83
- /**
84
- * Total number of cache hits
85
- */
86
- hits: number;
87
- /**
88
- * Total number of cache misses
89
- */
90
- misses: number;
91
- /**
92
- * Hit rate percentage
93
- */
94
- hitRate: number;
95
- /**
96
- * Total number of cached entries
97
- */
98
- size: number;
99
- /**
100
- * Total memory used (in bytes, if applicable)
101
- */
102
- memoryUsage?: number;
103
- }
104
- /**
105
- * Cache store interface
106
- */
107
- export interface ICacheStore {
108
- /**
109
- * Get a value from cache
110
- */
111
- get<T>(key: string): Promise<T | null>;
112
- /**
113
- * Set a value in cache
114
- */
115
- set<T>(key: string, value: T, ttl?: number): Promise<void>;
116
- /**
117
- * Delete a value from cache
118
- */
119
- delete(key: string): Promise<void>;
120
- /**
121
- * Check if key exists in cache
122
- */
123
- has(key: string): Promise<boolean>;
124
- /**
125
- * Clear all cache entries
126
- */
127
- clear(): Promise<void>;
128
- /**
129
- * Get all keys matching a pattern
130
- */
131
- keys(pattern?: string): Promise<string[]>;
132
- /**
133
- * Get cache statistics
134
- */
135
- getStats(): Promise<CacheStats>;
136
- }
137
- /**
138
- * Cache warming options
139
- */
140
- export interface CacheWarmingOptions {
141
- /**
142
- * Keys to warm up
143
- */
144
- keys: string[];
145
- /**
146
- * Function to fetch data for warming
147
- */
148
- fetcher: (key: string) => Promise<unknown>;
149
- /**
150
- * TTL for warmed entries
151
- */
152
- ttl?: number;
153
- /**
154
- * Whether to warm in parallel
155
- * @default true
156
- */
157
- parallel?: boolean;
158
- }
159
- /**
160
- * Cache invalidation event
161
- */
162
- export interface CacheInvalidationEvent {
163
- /**
164
- * Event name
165
- */
166
- event: string;
167
- /**
168
- * Keys to invalidate
169
- */
170
- keys?: string[];
171
- /**
172
- * Tags to invalidate
173
- */
174
- tags?: string[];
175
- /**
176
- * Timestamp
177
- */
178
- timestamp: number;
179
- }
180
- //# sourceMappingURL=cache.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.types.d.ts","sourceRoot":"","sources":["../src/cache.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAE9D;;GAEG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G,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE1C;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf;;OAEG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,93 +0,0 @@
1
- import 'reflect-metadata';
2
- import { CacheOptions } from '../cache.types';
3
- /**
4
- * Cache decorator for methods
5
- *
6
- * @example
7
- * ```typescript
8
- * @Cache({
9
- * strategy: 'memory',
10
- * ttl: 3600,
11
- * key: 'user-{id}',
12
- * tags: ['users']
13
- * })
14
- * @Get('/users/:id')
15
- * async getUser(@Param('id') id: string) {
16
- * return this.userService.findById(id);
17
- * }
18
- * ```
19
- */
20
- export declare function Cache(options?: CacheOptions): MethodDecorator;
21
- /**
22
- * Get cache metadata from a method
23
- */
24
- export declare function getCacheMetadata(target: object, propertyKey: string | symbol): CacheOptions | undefined;
25
- /**
26
- * Check if a method has cache metadata
27
- */
28
- export declare function hasCacheMetadata(target: object, propertyKey: string | symbol): boolean;
29
- /**
30
- * CacheKey decorator to specify custom cache key generation
31
- *
32
- * @example
33
- * ```typescript
34
- * @CacheKey('user-{id}-{role}')
35
- * @Get('/users/:id')
36
- * async getUser(@Param('id') id: string, @Query('role') role: string) {
37
- * return this.userService.findById(id);
38
- * }
39
- * ```
40
- */
41
- export declare function CacheKey(keyPattern: string): MethodDecorator;
42
- /**
43
- * CacheTTL decorator to specify cache TTL
44
- *
45
- * @example
46
- * ```typescript
47
- * @CacheTTL(7200) // 2 hours
48
- * @Get('/users')
49
- * async getUsers() {
50
- * return this.userService.findAll();
51
- * }
52
- * ```
53
- */
54
- export declare function CacheTTL(ttl: number): MethodDecorator;
55
- /**
56
- * CacheTags decorator to specify cache tags
57
- *
58
- * @example
59
- * ```typescript
60
- * @CacheTags(['users', 'profiles'])
61
- * @Get('/users/:id/profile')
62
- * async getUserProfile(@Param('id') id: string) {
63
- * return this.userService.getProfile(id);
64
- * }
65
- * ```
66
- */
67
- export declare function CacheTags(tags: string[]): MethodDecorator;
68
- /**
69
- * CacheEvict decorator to evict cache entries
70
- *
71
- * @example
72
- * ```typescript
73
- * @CacheEvict({ tags: ['users'] })
74
- * @Post('/users')
75
- * async createUser(@Body() user: CreateUserDto) {
76
- * return this.userService.create(user);
77
- * }
78
- * ```
79
- */
80
- export declare function CacheEvict(options: {
81
- keys?: string[];
82
- tags?: string[];
83
- all?: boolean;
84
- }): MethodDecorator;
85
- /**
86
- * Get cache evict metadata
87
- */
88
- export declare function getCacheEvictMetadata(target: object, propertyKey: string | symbol): {
89
- keys?: string[];
90
- tags?: string[];
91
- all?: boolean;
92
- } | undefined;
93
- //# sourceMappingURL=cache.decorator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/cache.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,eAAe,CAoBjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,YAAY,GAAG,SAAS,CAE1B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAEtF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,CAY5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAYrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CAYzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,GAAG,eAAe,CAMlB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B;IAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAEjE"}
@@ -1,155 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Cache = Cache;
7
- exports.getCacheMetadata = getCacheMetadata;
8
- exports.hasCacheMetadata = hasCacheMetadata;
9
- exports.CacheKey = CacheKey;
10
- exports.CacheTTL = CacheTTL;
11
- exports.CacheTags = CacheTags;
12
- exports.CacheEvict = CacheEvict;
13
- exports.getCacheEvictMetadata = getCacheEvictMetadata;
14
- require("reflect-metadata");
15
- const core_1 = __importDefault(require("@hazeljs/core"));
16
- const CACHE_METADATA_KEY = 'hazel:cache';
17
- /**
18
- * Cache decorator for methods
19
- *
20
- * @example
21
- * ```typescript
22
- * @Cache({
23
- * strategy: 'memory',
24
- * ttl: 3600,
25
- * key: 'user-{id}',
26
- * tags: ['users']
27
- * })
28
- * @Get('/users/:id')
29
- * async getUser(@Param('id') id: string) {
30
- * return this.userService.findById(id);
31
- * }
32
- * ```
33
- */
34
- function Cache(options = {}) {
35
- return (target, propertyKey, descriptor) => {
36
- const defaults = {
37
- strategy: 'memory',
38
- ttl: 3600,
39
- ttlStrategy: 'absolute',
40
- cacheNull: false,
41
- ...options,
42
- };
43
- // Store metadata
44
- Reflect.defineMetadata(CACHE_METADATA_KEY, defaults, target, propertyKey);
45
- core_1.default.debug(`Cache decorator applied to ${target.constructor.name}.${String(propertyKey)}`);
46
- // Note: The actual caching logic will be implemented by the CacheInterceptor
47
- // This decorator just marks the method and stores configuration
48
- return descriptor;
49
- };
50
- }
51
- /**
52
- * Get cache metadata from a method
53
- */
54
- function getCacheMetadata(target, propertyKey) {
55
- return Reflect.getMetadata(CACHE_METADATA_KEY, target, propertyKey);
56
- }
57
- /**
58
- * Check if a method has cache metadata
59
- */
60
- function hasCacheMetadata(target, propertyKey) {
61
- return Reflect.hasMetadata(CACHE_METADATA_KEY, target, propertyKey);
62
- }
63
- /**
64
- * CacheKey decorator to specify custom cache key generation
65
- *
66
- * @example
67
- * ```typescript
68
- * @CacheKey('user-{id}-{role}')
69
- * @Get('/users/:id')
70
- * async getUser(@Param('id') id: string, @Query('role') role: string) {
71
- * return this.userService.findById(id);
72
- * }
73
- * ```
74
- */
75
- function CacheKey(keyPattern) {
76
- return (target, propertyKey, descriptor) => {
77
- const existingMetadata = getCacheMetadata(target, propertyKey) || {};
78
- const updatedMetadata = {
79
- ...existingMetadata,
80
- key: keyPattern,
81
- };
82
- Reflect.defineMetadata(CACHE_METADATA_KEY, updatedMetadata, target, propertyKey);
83
- return descriptor;
84
- };
85
- }
86
- /**
87
- * CacheTTL decorator to specify cache TTL
88
- *
89
- * @example
90
- * ```typescript
91
- * @CacheTTL(7200) // 2 hours
92
- * @Get('/users')
93
- * async getUsers() {
94
- * return this.userService.findAll();
95
- * }
96
- * ```
97
- */
98
- function CacheTTL(ttl) {
99
- return (target, propertyKey, descriptor) => {
100
- const existingMetadata = getCacheMetadata(target, propertyKey) || {};
101
- const updatedMetadata = {
102
- ...existingMetadata,
103
- ttl,
104
- };
105
- Reflect.defineMetadata(CACHE_METADATA_KEY, updatedMetadata, target, propertyKey);
106
- return descriptor;
107
- };
108
- }
109
- /**
110
- * CacheTags decorator to specify cache tags
111
- *
112
- * @example
113
- * ```typescript
114
- * @CacheTags(['users', 'profiles'])
115
- * @Get('/users/:id/profile')
116
- * async getUserProfile(@Param('id') id: string) {
117
- * return this.userService.getProfile(id);
118
- * }
119
- * ```
120
- */
121
- function CacheTags(tags) {
122
- return (target, propertyKey, descriptor) => {
123
- const existingMetadata = getCacheMetadata(target, propertyKey) || {};
124
- const updatedMetadata = {
125
- ...existingMetadata,
126
- tags,
127
- };
128
- Reflect.defineMetadata(CACHE_METADATA_KEY, updatedMetadata, target, propertyKey);
129
- return descriptor;
130
- };
131
- }
132
- /**
133
- * CacheEvict decorator to evict cache entries
134
- *
135
- * @example
136
- * ```typescript
137
- * @CacheEvict({ tags: ['users'] })
138
- * @Post('/users')
139
- * async createUser(@Body() user: CreateUserDto) {
140
- * return this.userService.create(user);
141
- * }
142
- * ```
143
- */
144
- function CacheEvict(options) {
145
- return (target, propertyKey, descriptor) => {
146
- Reflect.defineMetadata('hazel:cache:evict', options, target, propertyKey);
147
- return descriptor;
148
- };
149
- }
150
- /**
151
- * Get cache evict metadata
152
- */
153
- function getCacheEvictMetadata(target, propertyKey) {
154
- return Reflect.getMetadata('hazel:cache:evict', target, propertyKey);
155
- }
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * @hazeljs/cache - Caching module for HazelJS
3
- */
4
- export { CacheModule, type CacheModuleOptions } from './cache.module';
5
- export { CacheService, CacheManager } from './cache.service';
6
- export { Cache, CacheKey, CacheTTL, CacheTags, CacheEvict, getCacheMetadata, hasCacheMetadata, getCacheEvictMetadata, } from './decorators/cache.decorator';
7
- export { type CacheOptions, type CacheStrategy, type TTLStrategy, type CacheEntry, type CacheStats, type ICacheStore, type CacheWarmingOptions, type CacheInvalidationEvent, } from './cache.types';
8
- export { MemoryCacheStore } from './strategies/memory.strategy';
9
- export { RedisCacheStore } from './strategies/redis.strategy';
10
- export { MultiTierCacheStore } from './strategies/multi-tier.strategy';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC"}
package/dist/index.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * @hazeljs/cache - Caching module for HazelJS
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MultiTierCacheStore = exports.RedisCacheStore = exports.MemoryCacheStore = exports.getCacheEvictMetadata = exports.hasCacheMetadata = exports.getCacheMetadata = exports.CacheEvict = exports.CacheTags = exports.CacheTTL = exports.CacheKey = exports.Cache = exports.CacheManager = exports.CacheService = exports.CacheModule = void 0;
7
- var cache_module_1 = require("./cache.module");
8
- Object.defineProperty(exports, "CacheModule", { enumerable: true, get: function () { return cache_module_1.CacheModule; } });
9
- var cache_service_1 = require("./cache.service");
10
- Object.defineProperty(exports, "CacheService", { enumerable: true, get: function () { return cache_service_1.CacheService; } });
11
- Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return cache_service_1.CacheManager; } });
12
- var cache_decorator_1 = require("./decorators/cache.decorator");
13
- Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return cache_decorator_1.Cache; } });
14
- Object.defineProperty(exports, "CacheKey", { enumerable: true, get: function () { return cache_decorator_1.CacheKey; } });
15
- Object.defineProperty(exports, "CacheTTL", { enumerable: true, get: function () { return cache_decorator_1.CacheTTL; } });
16
- Object.defineProperty(exports, "CacheTags", { enumerable: true, get: function () { return cache_decorator_1.CacheTags; } });
17
- Object.defineProperty(exports, "CacheEvict", { enumerable: true, get: function () { return cache_decorator_1.CacheEvict; } });
18
- Object.defineProperty(exports, "getCacheMetadata", { enumerable: true, get: function () { return cache_decorator_1.getCacheMetadata; } });
19
- Object.defineProperty(exports, "hasCacheMetadata", { enumerable: true, get: function () { return cache_decorator_1.hasCacheMetadata; } });
20
- Object.defineProperty(exports, "getCacheEvictMetadata", { enumerable: true, get: function () { return cache_decorator_1.getCacheEvictMetadata; } });
21
- var memory_strategy_1 = require("./strategies/memory.strategy");
22
- Object.defineProperty(exports, "MemoryCacheStore", { enumerable: true, get: function () { return memory_strategy_1.MemoryCacheStore; } });
23
- var redis_strategy_1 = require("./strategies/redis.strategy");
24
- Object.defineProperty(exports, "RedisCacheStore", { enumerable: true, get: function () { return redis_strategy_1.RedisCacheStore; } });
25
- var multi_tier_strategy_1 = require("./strategies/multi-tier.strategy");
26
- Object.defineProperty(exports, "MultiTierCacheStore", { enumerable: true, get: function () { return multi_tier_strategy_1.MultiTierCacheStore; } });
@@ -1,73 +0,0 @@
1
- import { ICacheStore, CacheStats } from '../cache.types';
2
- /**
3
- * In-memory cache store implementation
4
- */
5
- export declare class MemoryCacheStore implements ICacheStore {
6
- private cleanupIntervalMs;
7
- private cache;
8
- private tagIndex;
9
- private stats;
10
- private cleanupInterval?;
11
- constructor(cleanupIntervalMs?: number);
12
- /**
13
- * Get a value from cache
14
- */
15
- get<T>(key: string): Promise<T | null>;
16
- /**
17
- * Set a value in cache
18
- */
19
- set<T>(key: string, value: T, ttl?: number): Promise<void>;
20
- /**
21
- * Set a value with tags
22
- */
23
- setWithTags<T>(key: string, value: T, ttl: number, tags?: string[]): Promise<void>;
24
- /**
25
- * Delete a value from cache
26
- */
27
- delete(key: string): Promise<void>;
28
- /**
29
- * Delete entries by tag
30
- */
31
- deleteByTag(tag: string): Promise<void>;
32
- /**
33
- * Check if key exists in cache
34
- */
35
- has(key: string): Promise<boolean>;
36
- /**
37
- * Clear all cache entries
38
- */
39
- clear(): Promise<void>;
40
- /**
41
- * Get all keys matching a pattern
42
- */
43
- keys(pattern?: string): Promise<string[]>;
44
- /**
45
- * Get cache statistics
46
- */
47
- getStats(): Promise<CacheStats>;
48
- /**
49
- * Reset statistics
50
- */
51
- resetStats(): void;
52
- /**
53
- * Start cleanup interval
54
- */
55
- private startCleanup;
56
- /**
57
- * Stop cleanup interval
58
- */
59
- stopCleanup(): void;
60
- /**
61
- * Cleanup expired entries
62
- */
63
- private cleanup;
64
- /**
65
- * Remove key from tag index
66
- */
67
- private removeFromTagIndex;
68
- /**
69
- * Destroy the cache store
70
- */
71
- destroy(): void;
72
- }
73
- //# sourceMappingURL=memory.strategy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.strategy.d.ts","sourceRoot":"","sources":["../../src/strategies/memory.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAc,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGrE;;GAEG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAStC,OAAO,CAAC,iBAAiB;IARrC,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,QAAQ,CAAuC;IACvD,OAAO,CAAC,KAAK,CAGX;IACF,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAErB,iBAAiB,GAAE,MAAc;IAIrD;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IA4B5C;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IActE;;OAEG;IACG,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,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