@graphql-mesh/cache-redis 0.95.4 → 0.95.5
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/cjs/index.js +3 -0
- package/esm/index.js +3 -0
- package/package.json +3 -3
- package/typings/index.d.cts +2 -1
- package/typings/index.d.ts +2 -1
package/cjs/index.js
CHANGED
|
@@ -18,6 +18,7 @@ class RedisCache {
|
|
|
18
18
|
if (!['redis:', 'rediss:'].includes(redisUrl.protocol)) {
|
|
19
19
|
throw new Error('Redis URL must use either redis:// or rediss://');
|
|
20
20
|
}
|
|
21
|
+
options.logger.debug(`Connecting to Redis at ${redisUrl.toString()}`);
|
|
21
22
|
this.client = new ioredis_1.default(redisUrl?.toString());
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
@@ -25,6 +26,7 @@ class RedisCache {
|
|
|
25
26
|
const parsedPort = interpolateStrWithEnv(options.port?.toString());
|
|
26
27
|
const parsedPassword = interpolateStrWithEnv(options.password?.toString());
|
|
27
28
|
if (parsedHost) {
|
|
29
|
+
options.logger.debug(`Connecting to Redis at ${parsedHost}:${parsedPort}`);
|
|
28
30
|
this.client = new ioredis_1.default({
|
|
29
31
|
host: parsedHost,
|
|
30
32
|
port: parseInt(parsedPort),
|
|
@@ -35,6 +37,7 @@ class RedisCache {
|
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
else {
|
|
40
|
+
options.logger.debug(`Connecting to Redis mock`);
|
|
38
41
|
this.client = new ioredis_mock_1.default();
|
|
39
42
|
}
|
|
40
43
|
}
|
package/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export default class RedisCache {
|
|
|
15
15
|
if (!['redis:', 'rediss:'].includes(redisUrl.protocol)) {
|
|
16
16
|
throw new Error('Redis URL must use either redis:// or rediss://');
|
|
17
17
|
}
|
|
18
|
+
options.logger.debug(`Connecting to Redis at ${redisUrl.toString()}`);
|
|
18
19
|
this.client = new Redis(redisUrl?.toString());
|
|
19
20
|
}
|
|
20
21
|
else {
|
|
@@ -22,6 +23,7 @@ export default class RedisCache {
|
|
|
22
23
|
const parsedPort = interpolateStrWithEnv(options.port?.toString());
|
|
23
24
|
const parsedPassword = interpolateStrWithEnv(options.password?.toString());
|
|
24
25
|
if (parsedHost) {
|
|
26
|
+
options.logger.debug(`Connecting to Redis at ${parsedHost}:${parsedPort}`);
|
|
25
27
|
this.client = new Redis({
|
|
26
28
|
host: parsedHost,
|
|
27
29
|
port: parseInt(parsedPort),
|
|
@@ -32,6 +34,7 @@ export default class RedisCache {
|
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
else {
|
|
37
|
+
options.logger.debug(`Connecting to Redis mock`);
|
|
35
38
|
this.client = new RedisMock();
|
|
36
39
|
}
|
|
37
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/cache-redis",
|
|
3
|
-
"version": "0.95.
|
|
3
|
+
"version": "0.95.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@graphql-mesh/cross-helpers": "^0.4.0",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@graphql-mesh/string-interpolation": "0.5.1",
|
|
14
|
-
"ioredis": "5.3.2",
|
|
15
|
-
"ioredis-mock": "8.8.3"
|
|
14
|
+
"ioredis": "^5.3.2",
|
|
15
|
+
"ioredis-mock": "^8.8.3"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
package/typings/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { KeyValueCache, KeyValueCacheSetOptions, MeshPubSub, YamlConfig } from '@graphql-mesh/types';
|
|
1
|
+
import { KeyValueCache, KeyValueCacheSetOptions, Logger, MeshPubSub, YamlConfig } from '@graphql-mesh/types';
|
|
2
2
|
export default class RedisCache<V = string> implements KeyValueCache<V> {
|
|
3
3
|
private client;
|
|
4
4
|
constructor(options: YamlConfig.Cache['redis'] & {
|
|
5
5
|
pubsub: MeshPubSub;
|
|
6
|
+
logger: Logger;
|
|
6
7
|
});
|
|
7
8
|
set(key: string, value: V, options?: KeyValueCacheSetOptions): Promise<void>;
|
|
8
9
|
get(key: string): Promise<V | undefined>;
|
package/typings/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { KeyValueCache, KeyValueCacheSetOptions, MeshPubSub, YamlConfig } from '@graphql-mesh/types';
|
|
1
|
+
import { KeyValueCache, KeyValueCacheSetOptions, Logger, MeshPubSub, YamlConfig } from '@graphql-mesh/types';
|
|
2
2
|
export default class RedisCache<V = string> implements KeyValueCache<V> {
|
|
3
3
|
private client;
|
|
4
4
|
constructor(options: YamlConfig.Cache['redis'] & {
|
|
5
5
|
pubsub: MeshPubSub;
|
|
6
|
+
logger: Logger;
|
|
6
7
|
});
|
|
7
8
|
set(key: string, value: V, options?: KeyValueCacheSetOptions): Promise<void>;
|
|
8
9
|
get(key: string): Promise<V | undefined>;
|