Comparing version 0.4.0 to 0.5.0
export { FileKvStore } from './FileKvStore'; | ||
export { MemoryKvStore } from './MemoryKvStore'; | ||
export { RedisKvStore } from './RedisKvStore'; | ||
export { IoRedisKvStore } from './IoRedisKvStore'; | ||
export { KvStore } from './Types'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RedisKvStore = exports.MemoryKvStore = exports.FileKvStore = void 0; | ||
exports.IoRedisKvStore = exports.RedisKvStore = exports.MemoryKvStore = exports.FileKvStore = void 0; | ||
var FileKvStore_1 = require("./FileKvStore"); | ||
@@ -10,2 +10,4 @@ Object.defineProperty(exports, "FileKvStore", { enumerable: true, get: function () { return FileKvStore_1.FileKvStore; } }); | ||
Object.defineProperty(exports, "RedisKvStore", { enumerable: true, get: function () { return RedisKvStore_1.RedisKvStore; } }); | ||
var IoRedisKvStore_1 = require("./IoRedisKvStore"); | ||
Object.defineProperty(exports, "IoRedisKvStore", { enumerable: true, get: function () { return IoRedisKvStore_1.IoRedisKvStore; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -26,3 +26,11 @@ "use strict"; | ||
async list() { | ||
return this.redis.keys(`${this.prefix}*`); | ||
const keys = new Set(); | ||
let cursor = 0; | ||
do { | ||
const result = await this.redis.scan(cursor, { MATCH: `${this.prefix}*`, COUNT: 20 }); | ||
cursor = result.cursor; | ||
for (const key of result.keys) | ||
keys.add(key); | ||
} while (cursor !== 0); | ||
return Array.from(keys); | ||
} | ||
@@ -29,0 +37,0 @@ serializeValue(value) { |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@tus/utils", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Internal utils for tus Node.js server and stores", | ||
@@ -25,2 +25,3 @@ "main": "dist/index.js", | ||
"@types/node": "^20.11.5", | ||
"ioredis": "^5.4.1", | ||
"mocha": "^10.4.0", | ||
@@ -27,0 +28,0 @@ "should": "^13.2.3", |
export {FileKvStore} from './FileKvStore' | ||
export {MemoryKvStore} from './MemoryKvStore' | ||
export {RedisKvStore} from './RedisKvStore' | ||
export {IoRedisKvStore} from './IoRedisKvStore' | ||
export {KvStore} from './Types' |
@@ -32,3 +32,10 @@ import type {RedisClientType} from '@redis/client' | ||
async list(): Promise<Array<string>> { | ||
return this.redis.keys(`${this.prefix}*`) | ||
const keys = new Set<string>() | ||
let cursor = 0 | ||
do { | ||
const result = await this.redis.scan(cursor, {MATCH: `${this.prefix}*`, COUNT: 20}) | ||
cursor = result.cursor | ||
for (const key of result.keys) keys.add(key) | ||
} while (cursor !== 0) | ||
return Array.from(keys) | ||
} | ||
@@ -35,0 +42,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87083
86
1641
7