@mondart/nestjs-common-module 1.1.50 → 1.1.51
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.
|
@@ -12,20 +12,24 @@ const common_1 = require("@nestjs/common");
|
|
|
12
12
|
const caching_service_1 = require("./caching.service");
|
|
13
13
|
const cache_manager_1 = require("@nestjs/cache-manager");
|
|
14
14
|
const caching_interface_1 = require("./caching.interface");
|
|
15
|
-
const
|
|
15
|
+
const cache_manager_ioredis_yet_1 = require("cache-manager-ioredis-yet");
|
|
16
16
|
let CachingModule = CachingModule_1 = class CachingModule {
|
|
17
17
|
static register(options) {
|
|
18
|
-
const cacheModuleOptions = {
|
|
19
|
-
store: redisStore,
|
|
20
|
-
ttl: Number(options.ttl),
|
|
21
|
-
host: options.host,
|
|
22
|
-
port: Number(options.port),
|
|
23
|
-
password: options.password,
|
|
24
|
-
max: 10000,
|
|
25
|
-
};
|
|
26
18
|
return {
|
|
27
19
|
module: CachingModule_1,
|
|
28
|
-
imports: [
|
|
20
|
+
imports: [
|
|
21
|
+
cache_manager_1.CacheModule.register({
|
|
22
|
+
isGlobal: true,
|
|
23
|
+
useFactory: async (cachingOptions) => ({
|
|
24
|
+
store: await (0, cache_manager_ioredis_yet_1.redisStore)({
|
|
25
|
+
host: cachingOptions.host,
|
|
26
|
+
port: cachingOptions.port,
|
|
27
|
+
password: cachingOptions.password,
|
|
28
|
+
ttl: cachingOptions.ttl,
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
29
33
|
providers: [
|
|
30
34
|
{
|
|
31
35
|
provide: caching_interface_1.CACHING_MODULE_OPTIONS,
|
|
@@ -46,17 +50,24 @@ let CachingModule = CachingModule_1 = class CachingModule {
|
|
|
46
50
|
cache_manager_1.CacheModule.registerAsync({
|
|
47
51
|
imports: [asyncOptionsProvider],
|
|
48
52
|
useFactory: async (cachingOptions) => ({
|
|
49
|
-
store: redisStore
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
store: await (0, cache_manager_ioredis_yet_1.redisStore)({
|
|
54
|
+
host: cachingOptions.host,
|
|
55
|
+
port: cachingOptions.port,
|
|
56
|
+
password: cachingOptions.password,
|
|
57
|
+
ttl: cachingOptions.ttl,
|
|
58
|
+
}),
|
|
54
59
|
max: 10000,
|
|
55
60
|
}),
|
|
56
61
|
inject: [caching_interface_1.CACHING_MODULE_OPTIONS],
|
|
57
62
|
}),
|
|
58
63
|
],
|
|
59
|
-
providers: [
|
|
64
|
+
providers: [
|
|
65
|
+
{
|
|
66
|
+
provide: caching_service_1.CachingService,
|
|
67
|
+
useFactory: (cacheManager) => new caching_service_1.CachingService(cacheManager),
|
|
68
|
+
inject: [cache_manager_1.CACHE_MANAGER],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
60
71
|
exports: [caching_service_1.CachingService, cache_manager_1.CacheModule],
|
|
61
72
|
};
|
|
62
73
|
}
|