@nest-omni/core 3.1.1-18 → 3.1.1-19

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.
Files changed (37) hide show
  1. package/cache/cache-serialization.service.d.ts +4 -11
  2. package/cache/cache-serialization.service.js +29 -124
  3. package/cache/cache.constants.d.ts +2 -0
  4. package/cache/cache.constants.js +5 -0
  5. package/cache/cache.module.d.ts +2 -0
  6. package/cache/cache.module.js +49 -3
  7. package/cache/cache.service.d.ts +3 -1
  8. package/cache/cache.service.js +32 -4
  9. package/cache/examples/basic-usage.d.ts +58 -0
  10. package/cache/examples/basic-usage.js +379 -0
  11. package/cache/index.d.ts +2 -1
  12. package/cache/index.js +4 -1
  13. package/common/boilerplate.polyfill.d.ts +0 -6
  14. package/common/dto/page-options.dto.d.ts +0 -3
  15. package/common/dto/page-options.dto.js +0 -12
  16. package/common/examples/paginate-and-map.example.d.ts +14 -0
  17. package/common/examples/paginate-and-map.example.js +158 -0
  18. package/decorators/examples/validation-decorators.example.d.ts +69 -0
  19. package/decorators/examples/validation-decorators.example.js +331 -0
  20. package/decorators/validator.decorators.d.ts +8 -1
  21. package/decorators/validator.decorators.js +115 -0
  22. package/i18n/en_US/validation.json +4 -1
  23. package/i18n/zh_CN/validation.json +4 -1
  24. package/index.d.ts +1 -0
  25. package/index.js +1 -0
  26. package/package.json +1 -1
  27. package/redis-lock/examples/lock-strategy.examples.d.ts +73 -0
  28. package/redis-lock/examples/lock-strategy.examples.js +387 -0
  29. package/redis-lock/index.d.ts +2 -2
  30. package/redis-lock/index.js +4 -1
  31. package/redis-lock/redis-lock.decorator.d.ts +4 -0
  32. package/redis-lock/redis-lock.decorator.js +43 -7
  33. package/redis-lock/redis-lock.service.d.ts +19 -0
  34. package/redis-lock/redis-lock.service.js +131 -6
  35. package/setup/index.d.ts +0 -1
  36. package/setup/index.js +0 -1
  37. package/shared/serviceRegistryModule.js +2 -0
@@ -1,9 +1,6 @@
1
1
  export interface CacheSerializationOptions {
2
2
  compress?: boolean;
3
3
  compressThreshold?: number;
4
- serializer?: (value: any) => string;
5
- deserializer?: (data: string) => any;
6
- preserveTypes?: boolean;
7
4
  }
8
5
  export interface SerializationResult {
9
6
  data: Buffer;
@@ -14,16 +11,12 @@ export interface SerializationResult {
14
11
  export interface DeserializationResult<T> {
15
12
  data: T;
16
13
  wasCompressed: boolean;
17
- wasSerialized: boolean;
18
14
  }
19
15
  export declare class CacheSerializationService {
20
16
  private readonly logger;
21
17
  serialize<T>(value: T, options?: CacheSerializationOptions): Promise<SerializationResult>;
22
- deserialize<T>(buffer: Buffer, options?: CacheSerializationOptions): Promise<DeserializationResult<T>>;
23
- getSerializationStats(value: any, options?: CacheSerializationOptions): any;
24
- validateSerializedData(buffer: Buffer): boolean;
25
- getOptimalOptions(value: any): CacheSerializationOptions;
26
- private preserveTypeSerialization;
27
- private preserveTypeDeserialization;
28
- private hasComplexTypes;
18
+ deserialize<T>(buffer: Buffer): Promise<DeserializationResult<T>>;
19
+ private serializeWithDates;
20
+ private preProcessDates;
21
+ private deserializeWithDates;
29
22
  }
@@ -28,35 +28,24 @@ let CacheSerializationService = CacheSerializationService_1 = class CacheSeriali
28
28
  }
29
29
  serialize(value_1) {
30
30
  return __awaiter(this, arguments, void 0, function* (value, options = {}) {
31
- const { compress = false, compressThreshold = 1024, serializer, preserveTypes = true, } = options;
31
+ const { compress = false, compressThreshold = 1024 } = options;
32
32
  try {
33
- let serializedData;
34
- let wasSerialized = false;
35
- if (serializer) {
36
- serializedData = serializer(value);
37
- wasSerialized = true;
38
- }
39
- else {
40
- serializedData = preserveTypes
41
- ? this.preserveTypeSerialization(value)
42
- : JSON.stringify(value);
43
- wasSerialized = true;
44
- }
45
- const originalSize = Buffer.byteLength(serializedData, 'utf8');
33
+ const serialized = this.serializeWithDates(value);
34
+ const originalSize = Buffer.byteLength(serialized, 'utf8');
46
35
  let data;
47
36
  let wasCompressed = false;
48
37
  if (compress && originalSize >= compressThreshold) {
49
38
  try {
50
- data = yield gzipAsync(Buffer.from(serializedData, 'utf8'));
39
+ data = yield gzipAsync(Buffer.from(serialized, 'utf8'));
51
40
  wasCompressed = true;
52
41
  }
53
42
  catch (error) {
54
43
  this.logger.warn('Compression failed, using uncompressed data:', error);
55
- data = Buffer.from(serializedData, 'utf8');
44
+ data = Buffer.from(serialized, 'utf8');
56
45
  }
57
46
  }
58
47
  else {
59
- data = Buffer.from(serializedData, 'utf8');
48
+ data = Buffer.from(serialized, 'utf8');
60
49
  }
61
50
  return {
62
51
  data,
@@ -71,9 +60,8 @@ let CacheSerializationService = CacheSerializationService_1 = class CacheSeriali
71
60
  }
72
61
  });
73
62
  }
74
- deserialize(buffer_1) {
75
- return __awaiter(this, arguments, void 0, function* (buffer, options = {}) {
76
- const { deserializer, preserveTypes = true } = options;
63
+ deserialize(buffer) {
64
+ return __awaiter(this, void 0, void 0, function* () {
77
65
  try {
78
66
  let dataString;
79
67
  let wasCompressed = false;
@@ -84,20 +72,10 @@ let CacheSerializationService = CacheSerializationService_1 = class CacheSeriali
84
72
  else {
85
73
  dataString = buffer.toString('utf8');
86
74
  }
87
- let data;
88
- let wasSerialized = true;
89
- if (deserializer) {
90
- data = deserializer(dataString);
91
- }
92
- else {
93
- data = preserveTypes
94
- ? this.preserveTypeDeserialization(dataString)
95
- : JSON.parse(dataString);
96
- }
75
+ const data = this.deserializeWithDates(dataString);
97
76
  return {
98
77
  data,
99
78
  wasCompressed,
100
- wasSerialized,
101
79
  };
102
80
  }
103
81
  catch (error) {
@@ -106,110 +84,37 @@ let CacheSerializationService = CacheSerializationService_1 = class CacheSeriali
106
84
  }
107
85
  });
108
86
  }
109
- getSerializationStats(value, options = {}) {
110
- const valueStr = JSON.stringify(value);
111
- const valueSize = Buffer.byteLength(valueStr, 'utf8');
112
- return {
113
- originalSize: valueSize,
114
- estimatedCompressedSize: Math.floor(valueSize * 0.6),
115
- recommendedCompression: valueSize >= (options.compressThreshold || 1024),
116
- hasComplexTypes: this.hasComplexTypes(value),
117
- };
87
+ serializeWithDates(value) {
88
+ const processed = this.preProcessDates(value);
89
+ return JSON.stringify(processed);
118
90
  }
119
- validateSerializedData(buffer) {
120
- if (!Buffer.isBuffer(buffer)) {
121
- return false;
91
+ preProcessDates(obj) {
92
+ if (obj === null || obj === undefined) {
93
+ return obj;
122
94
  }
123
- if (buffer.length === 0) {
124
- return false;
95
+ if (obj instanceof Date) {
96
+ return { __type: 'Date', value: obj.toISOString() };
125
97
  }
126
- if (!(buffer.length >= 2 && buffer[0] === 0x1f && buffer[1] === 0x8b)) {
127
- try {
128
- buffer.toString('utf8');
129
- return true;
130
- }
131
- catch (_a) {
132
- return false;
133
- }
98
+ if (Array.isArray(obj)) {
99
+ return obj.map((item) => this.preProcessDates(item));
134
100
  }
135
- return true;
136
- }
137
- getOptimalOptions(value) {
138
- const stats = this.getSerializationStats(value);
139
- const options = {};
140
- if (stats.recommendedCompression) {
141
- options.compress = true;
142
- options.compressThreshold = 1024;
143
- }
144
- if (stats.hasComplexTypes) {
145
- options.preserveTypes = true;
146
- }
147
- return options;
148
- }
149
- preserveTypeSerialization(value) {
150
- return JSON.stringify(value, (key, val) => {
151
- if (val instanceof Date) {
152
- return { __type: 'Date', value: val.toISOString() };
101
+ if (typeof obj === 'object') {
102
+ const processed = {};
103
+ for (const [key, value] of Object.entries(obj)) {
104
+ processed[key] = this.preProcessDates(value);
153
105
  }
154
- if (val instanceof RegExp) {
155
- return { __type: 'RegExp', value: val.source, flags: val.flags };
156
- }
157
- if (val instanceof Set) {
158
- return { __type: 'Set', value: Array.from(val) };
159
- }
160
- if (val instanceof Map) {
161
- return { __type: 'Map', value: Array.from(val.entries()) };
162
- }
163
- if (typeof val === 'bigint') {
164
- return { __type: 'BigInt', value: val.toString() };
165
- }
166
- if (Buffer.isBuffer(val)) {
167
- return { __type: 'Buffer', value: Array.from(val) };
168
- }
169
- return val;
170
- });
106
+ return processed;
107
+ }
108
+ return obj;
171
109
  }
172
- preserveTypeDeserialization(dataString) {
110
+ deserializeWithDates(dataString) {
173
111
  return JSON.parse(dataString, (key, val) => {
174
- if (val && typeof val === 'object' && val.__type) {
175
- switch (val.__type) {
176
- case 'Date':
177
- return new Date(val.value);
178
- case 'RegExp':
179
- return new RegExp(val.value, val.flags);
180
- case 'Set':
181
- return new Set(val.value);
182
- case 'Map':
183
- return new Map(val.value);
184
- case 'BigInt':
185
- return BigInt(val.value);
186
- case 'Buffer':
187
- return Buffer.from(val.value);
188
- default:
189
- return val;
190
- }
112
+ if (val && typeof val === 'object' && val.__type === 'Date') {
113
+ return new Date(val.value);
191
114
  }
192
115
  return val;
193
116
  });
194
117
  }
195
- hasComplexTypes(value) {
196
- if (value instanceof Date ||
197
- value instanceof RegExp ||
198
- value instanceof Set ||
199
- value instanceof Map) {
200
- return true;
201
- }
202
- if (Buffer.isBuffer(value) || typeof value === 'bigint') {
203
- return true;
204
- }
205
- if (Array.isArray(value)) {
206
- return value.some((item) => this.hasComplexTypes(item));
207
- }
208
- if (value && typeof value === 'object') {
209
- return Object.values(value).some((item) => this.hasComplexTypes(item));
210
- }
211
- return false;
212
- }
213
118
  };
214
119
  exports.CacheSerializationService = CacheSerializationService;
215
120
  exports.CacheSerializationService = CacheSerializationService = CacheSerializationService_1 = __decorate([
@@ -0,0 +1,2 @@
1
+ export declare const CACHE_COMPRESSION_ENABLED: unique symbol;
2
+ export declare const CACHE_COMPRESSION_THRESHOLD: unique symbol;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CACHE_COMPRESSION_THRESHOLD = exports.CACHE_COMPRESSION_ENABLED = void 0;
4
+ exports.CACHE_COMPRESSION_ENABLED = Symbol('CACHE_COMPRESSION_ENABLED');
5
+ exports.CACHE_COMPRESSION_THRESHOLD = Symbol('CACHE_COMPRESSION_THRESHOLD');
@@ -9,6 +9,8 @@ export interface CacheModuleOptions {
9
9
  dataSource?: DataSource;
10
10
  memoryTtl?: number;
11
11
  memoryNamespace?: string;
12
+ enableCompression?: boolean;
13
+ compressionThreshold?: number;
12
14
  }
13
15
  export declare class CacheModule implements OnModuleInit {
14
16
  private readonly cacheService;
@@ -13,16 +13,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.CacheModule = exports.CACHE_SERVICE = void 0;
14
14
  const common_1 = require("@nestjs/common");
15
15
  const cache_service_1 = require("./cache.service");
16
+ const cache_warmup_service_1 = require("./cache.warmup.service");
17
+ const cache_metrics_service_1 = require("./cache-metrics.service");
18
+ const cache_serialization_service_1 = require("./cache-serialization.service");
16
19
  const dependencies_1 = require("./dependencies");
17
20
  const decorators_1 = require("./decorators");
18
21
  const providers_1 = require("./providers");
22
+ const cache_constants_1 = require("./cache.constants");
19
23
  exports.CACHE_SERVICE = Symbol('CACHE_SERVICE');
20
24
  let CacheModule = CacheModule_1 = class CacheModule {
21
25
  constructor(cacheService) {
22
26
  this.cacheService = cacheService;
23
27
  }
24
28
  static forRoot(options = {}) {
25
- const { isGlobal = true, redisClient, dataSource, memoryTtl, memoryNamespace, } = options;
29
+ const { isGlobal = true, redisClient, dataSource, memoryTtl, memoryNamespace, enableCompression = false, compressionThreshold = 1024, } = options;
26
30
  if (dataSource) {
27
31
  dependencies_1.DbDependency.setDataSource(dataSource);
28
32
  }
@@ -47,13 +51,33 @@ let CacheModule = CacheModule_1 = class CacheModule {
47
51
  ]
48
52
  : []),
49
53
  providers_1.RedisCacheProvider,
54
+ {
55
+ provide: cache_constants_1.CACHE_COMPRESSION_ENABLED,
56
+ useValue: enableCompression,
57
+ },
58
+ {
59
+ provide: cache_constants_1.CACHE_COMPRESSION_THRESHOLD,
60
+ useValue: compressionThreshold,
61
+ },
62
+ cache_warmup_service_1.CacheWarmupService,
63
+ cache_metrics_service_1.CacheMetricsService,
64
+ {
65
+ provide: cache_serialization_service_1.CacheSerializationService,
66
+ useFactory: () => new cache_serialization_service_1.CacheSerializationService(),
67
+ },
50
68
  {
51
69
  provide: exports.CACHE_SERVICE,
52
70
  useClass: cache_service_1.CacheService,
53
71
  },
54
72
  cache_service_1.CacheService,
55
73
  ],
56
- exports: [exports.CACHE_SERVICE, cache_service_1.CacheService],
74
+ exports: [
75
+ exports.CACHE_SERVICE,
76
+ cache_service_1.CacheService,
77
+ cache_warmup_service_1.CacheWarmupService,
78
+ cache_metrics_service_1.CacheMetricsService,
79
+ cache_serialization_service_1.CacheSerializationService,
80
+ ],
57
81
  };
58
82
  }
59
83
  static forRootAsync(options) {
@@ -88,13 +112,35 @@ let CacheModule = CacheModule_1 = class CacheModule {
88
112
  inject: ['CACHE_MODULE_OPTIONS'],
89
113
  },
90
114
  providers_1.RedisCacheProvider,
115
+ cache_warmup_service_1.CacheWarmupService,
116
+ cache_metrics_service_1.CacheMetricsService,
117
+ {
118
+ provide: cache_serialization_service_1.CacheSerializationService,
119
+ useFactory: () => new cache_serialization_service_1.CacheSerializationService(),
120
+ },
121
+ {
122
+ provide: cache_constants_1.CACHE_COMPRESSION_ENABLED,
123
+ useFactory: (moduleOptions) => moduleOptions.enableCompression || false,
124
+ inject: ['CACHE_MODULE_OPTIONS'],
125
+ },
126
+ {
127
+ provide: cache_constants_1.CACHE_COMPRESSION_THRESHOLD,
128
+ useFactory: (moduleOptions) => moduleOptions.compressionThreshold || 1024,
129
+ inject: ['CACHE_MODULE_OPTIONS'],
130
+ },
91
131
  {
92
132
  provide: exports.CACHE_SERVICE,
93
133
  useClass: cache_service_1.CacheService,
94
134
  },
95
135
  cache_service_1.CacheService,
96
136
  ],
97
- exports: [exports.CACHE_SERVICE, cache_service_1.CacheService],
137
+ exports: [
138
+ exports.CACHE_SERVICE,
139
+ cache_service_1.CacheService,
140
+ cache_warmup_service_1.CacheWarmupService,
141
+ cache_metrics_service_1.CacheMetricsService,
142
+ cache_serialization_service_1.CacheSerializationService,
143
+ ],
98
144
  };
99
145
  }
100
146
  onModuleInit() {
@@ -5,10 +5,12 @@ export declare class CacheService {
5
5
  private readonly clsProvider;
6
6
  private readonly memoryProvider;
7
7
  private readonly redisProvider;
8
+ private readonly enableCompression;
9
+ private readonly compressionThreshold;
8
10
  private readonly logger;
9
11
  private readonly providers;
10
12
  private readonly stats;
11
- constructor(clsProvider: ClsCacheProvider, memoryProvider: MemoryCacheProvider, redisProvider: RedisCacheProvider);
13
+ constructor(clsProvider: ClsCacheProvider, memoryProvider: MemoryCacheProvider, redisProvider: RedisCacheProvider, enableCompression?: boolean, compressionThreshold?: number);
12
14
  getOrSet<T>(key: string, factory: () => Promise<T>, options?: CacheOptions): Promise<T>;
13
15
  get<T>(key: string, options?: CacheOptions): Promise<T | null>;
14
16
  set<T>(key: string, value: T, options?: CacheOptions | number): Promise<void>;
@@ -8,6 +8,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
15
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
16
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -25,11 +28,15 @@ const dependencies_1 = require("./dependencies");
25
28
  const interfaces_1 = require("./interfaces");
26
29
  const providers_1 = require("./providers");
27
30
  const utils_1 = require("./utils");
31
+ const cache_serialization_service_1 = require("./cache-serialization.service");
32
+ const cache_constants_1 = require("./cache.constants");
28
33
  let CacheService = CacheService_1 = class CacheService {
29
- constructor(clsProvider, memoryProvider, redisProvider) {
34
+ constructor(clsProvider, memoryProvider, redisProvider, enableCompression = false, compressionThreshold = 1024) {
30
35
  this.clsProvider = clsProvider;
31
36
  this.memoryProvider = memoryProvider;
32
37
  this.redisProvider = redisProvider;
38
+ this.enableCompression = enableCompression;
39
+ this.compressionThreshold = compressionThreshold;
33
40
  this.logger = new common_1.Logger(CacheService_1.name);
34
41
  this.providers = new Map();
35
42
  this.stats = {
@@ -72,8 +79,13 @@ let CacheService = CacheService_1 = class CacheService {
72
79
  try {
73
80
  const wrapped = yield provider.get(fullKey);
74
81
  if (wrapped !== null) {
75
- const value = yield utils_1.DependencyManager.unwrapAndValidate(wrapped, options === null || options === void 0 ? void 0 : options.dependencies);
82
+ let value = yield utils_1.DependencyManager.unwrapAndValidate(wrapped, options === null || options === void 0 ? void 0 : options.dependencies);
76
83
  if (value !== null) {
84
+ if (this.enableCompression && Buffer.isBuffer(value)) {
85
+ const serializationService = new cache_serialization_service_1.CacheSerializationService();
86
+ const decompressed = yield serializationService.deserialize(value);
87
+ value = decompressed.data;
88
+ }
77
89
  this.recordHit(layer);
78
90
  if ((options === null || options === void 0 ? void 0 : options.backfill) !== false && i > 0) {
79
91
  yield this.backfillUpperLayers(fullKey, wrapped, layers.slice(0, i), options === null || options === void 0 ? void 0 : options.ttl);
@@ -197,7 +209,19 @@ let CacheService = CacheService_1 = class CacheService {
197
209
  }
198
210
  const layers = this.resolveLayers(options === null || options === void 0 ? void 0 : options.layers);
199
211
  const fullKey = this.buildKey(key, options === null || options === void 0 ? void 0 : options.namespace);
200
- const wrapped = yield utils_1.DependencyManager.wrapWithDependencies(value, options === null || options === void 0 ? void 0 : options.dependencies);
212
+ let processedValue = value;
213
+ if (this.enableCompression &&
214
+ value !== null &&
215
+ value !== undefined &&
216
+ JSON.stringify(value).length >= this.compressionThreshold) {
217
+ const serializationService = new cache_serialization_service_1.CacheSerializationService();
218
+ const compressed = yield serializationService.serialize(value, {
219
+ compress: true,
220
+ compressThreshold: this.compressionThreshold,
221
+ });
222
+ processedValue = compressed.data;
223
+ }
224
+ const wrapped = yield utils_1.DependencyManager.wrapWithDependencies(processedValue, options === null || options === void 0 ? void 0 : options.dependencies);
201
225
  const promises = layers.map((layer) => __awaiter(this, void 0, void 0, function* () {
202
226
  const provider = this.providers.get(layer);
203
227
  if (!provider) {
@@ -274,7 +298,11 @@ let CacheService = CacheService_1 = class CacheService {
274
298
  exports.CacheService = CacheService;
275
299
  exports.CacheService = CacheService = CacheService_1 = __decorate([
276
300
  (0, common_1.Injectable)(),
301
+ __param(3, (0, common_1.Optional)()),
302
+ __param(3, (0, common_1.Inject)(cache_constants_1.CACHE_COMPRESSION_ENABLED)),
303
+ __param(4, (0, common_1.Optional)()),
304
+ __param(4, (0, common_1.Inject)(cache_constants_1.CACHE_COMPRESSION_THRESHOLD)),
277
305
  __metadata("design:paramtypes", [providers_1.ClsCacheProvider,
278
306
  providers_1.MemoryCacheProvider,
279
- providers_1.RedisCacheProvider])
307
+ providers_1.RedisCacheProvider, Boolean, Number])
280
308
  ], CacheService);
@@ -0,0 +1,58 @@
1
+ import { CacheService } from '../index';
2
+ interface User {
3
+ id: string;
4
+ name: string;
5
+ email: string;
6
+ profile: {
7
+ bio: string;
8
+ avatar: string;
9
+ };
10
+ }
11
+ interface Post {
12
+ id: string;
13
+ title: string;
14
+ content: string;
15
+ authorId: string;
16
+ createdAt: Date;
17
+ }
18
+ declare class UserRepository {
19
+ findOne(id: string): Promise<User>;
20
+ findMany(ids: string[]): Promise<User[]>;
21
+ findAll(): Promise<User[]>;
22
+ save(user: Partial<User>): Promise<User>;
23
+ delete(id: string): Promise<void>;
24
+ }
25
+ declare class PostRepository {
26
+ findByAuthor(authorId: string): Promise<Post[]>;
27
+ }
28
+ export declare class UserService {
29
+ private cacheService;
30
+ private userRepository;
31
+ constructor(cacheService: CacheService, userRepository: UserRepository);
32
+ getUser(id: string): Promise<User>;
33
+ getUserProfile(id: string): Promise<User>;
34
+ getUserData(id: string): Promise<User>;
35
+ getUsersBatch(ids: string[]): Promise<User[]>;
36
+ updateUser(id: string, data: Partial<User>): Promise<User>;
37
+ deleteUser(id: string): Promise<void>;
38
+ invalidateAllProfiles(): Promise<void>;
39
+ cacheLargeData(id: string): Promise<void>;
40
+ getLargeData(id: string): Promise<any>;
41
+ }
42
+ export declare class PostService {
43
+ private cacheService;
44
+ private postRepository;
45
+ constructor(cacheService: CacheService, postRepository: PostRepository);
46
+ getPostsByAuthor(authorId: string): Promise<Post[]>;
47
+ getFeaturedPosts(): Promise<Post[]>;
48
+ private getConfigVersion;
49
+ }
50
+ export declare class CacheMonitoringService {
51
+ private cacheService;
52
+ constructor(cacheService: CacheService);
53
+ getCacheStats(): import("../index").CacheStats;
54
+ resetStats(): void;
55
+ startMonitoring(intervalMs?: number): void;
56
+ }
57
+ declare function demonstrateCacheUsage(): Promise<void>;
58
+ export { demonstrateCacheUsage };