@graphql-mesh/cache-upstash-redis 0.0.1-alpha-20250131090929-a30bb9a75b98ce99d6636ae9ffda520197be4687 → 0.0.1-alpha-20250131115133-3c62e017e2fbfe0cd29e38d505b465efd3b624fb
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 +12 -2
- package/esm/index.js +12 -2
- package/package.json +1 -1
- package/typings/index.d.cts +1 -2
- package/typings/index.d.ts +1 -2
package/cjs/index.js
CHANGED
|
@@ -32,8 +32,18 @@ class UpstashRedisCache {
|
|
|
32
32
|
const num = await this.redis.del(key);
|
|
33
33
|
return num > 0;
|
|
34
34
|
}
|
|
35
|
-
getKeysByPrefix(prefix) {
|
|
36
|
-
|
|
35
|
+
async getKeysByPrefix(prefix) {
|
|
36
|
+
const keys = [];
|
|
37
|
+
let cursor = '0';
|
|
38
|
+
do {
|
|
39
|
+
const result = await this.redis.scan(cursor, {
|
|
40
|
+
match: prefix + '*',
|
|
41
|
+
count: 100,
|
|
42
|
+
});
|
|
43
|
+
cursor = result[0];
|
|
44
|
+
keys.push(...result[1]);
|
|
45
|
+
} while (cursor !== '0');
|
|
46
|
+
return keys;
|
|
37
47
|
}
|
|
38
48
|
[disposablestack_1.DisposableSymbols.dispose]() {
|
|
39
49
|
return this.abortCtrl.abort();
|
package/esm/index.js
CHANGED
|
@@ -30,8 +30,18 @@ export default class UpstashRedisCache {
|
|
|
30
30
|
const num = await this.redis.del(key);
|
|
31
31
|
return num > 0;
|
|
32
32
|
}
|
|
33
|
-
getKeysByPrefix(prefix) {
|
|
34
|
-
|
|
33
|
+
async getKeysByPrefix(prefix) {
|
|
34
|
+
const keys = [];
|
|
35
|
+
let cursor = '0';
|
|
36
|
+
do {
|
|
37
|
+
const result = await this.redis.scan(cursor, {
|
|
38
|
+
match: prefix + '*',
|
|
39
|
+
count: 100,
|
|
40
|
+
});
|
|
41
|
+
cursor = result[0];
|
|
42
|
+
keys.push(...result[1]);
|
|
43
|
+
} while (cursor !== '0');
|
|
44
|
+
return keys;
|
|
35
45
|
}
|
|
36
46
|
[DisposableSymbols.dispose]() {
|
|
37
47
|
return this.abortCtrl.abort();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/cache-upstash-redis",
|
|
3
|
-
"version": "0.0.1-alpha-
|
|
3
|
+
"version": "0.0.1-alpha-20250131115133-3c62e017e2fbfe0cd29e38d505b465efd3b624fb",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "*"
|
package/typings/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { KeyValueCache } from '@graphql-mesh/types';
|
|
2
|
-
import type { MaybePromise } from '@graphql-tools/utils';
|
|
3
2
|
import { type RedisConfigNodejs } from '@upstash/redis';
|
|
4
3
|
import { DisposableSymbols } from '@whatwg-node/disposablestack';
|
|
5
4
|
export default class UpstashRedisCache implements KeyValueCache {
|
|
@@ -11,6 +10,6 @@ export default class UpstashRedisCache implements KeyValueCache {
|
|
|
11
10
|
ttl?: number;
|
|
12
11
|
}): Promise<void>;
|
|
13
12
|
delete(key: string): Promise<boolean>;
|
|
14
|
-
getKeysByPrefix(prefix: string):
|
|
13
|
+
getKeysByPrefix(prefix: string): Promise<string[]>;
|
|
15
14
|
[DisposableSymbols.dispose](): void;
|
|
16
15
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { KeyValueCache } from '@graphql-mesh/types';
|
|
2
|
-
import type { MaybePromise } from '@graphql-tools/utils';
|
|
3
2
|
import { type RedisConfigNodejs } from '@upstash/redis';
|
|
4
3
|
import { DisposableSymbols } from '@whatwg-node/disposablestack';
|
|
5
4
|
export default class UpstashRedisCache implements KeyValueCache {
|
|
@@ -11,6 +10,6 @@ export default class UpstashRedisCache implements KeyValueCache {
|
|
|
11
10
|
ttl?: number;
|
|
12
11
|
}): Promise<void>;
|
|
13
12
|
delete(key: string): Promise<boolean>;
|
|
14
|
-
getKeysByPrefix(prefix: string):
|
|
13
|
+
getKeysByPrefix(prefix: string): Promise<string[]>;
|
|
15
14
|
[DisposableSymbols.dispose](): void;
|
|
16
15
|
}
|