diff --git a/libs/redis-store/src/index.ts b/libs/redis-store/src/index.ts index 18d7505..ae0dcd4 100644 --- a/libs/redis-store/src/index.ts +++ b/libs/redis-store/src/index.ts @@ -139,16 +139,6 @@ export class RedisStore implements IStore { return this.decode(data); } - /** - * Retrieves multiple keys from Redis using a single hmget call. - * @param keys The keys to retrieve - * @returns An array of the values - */ - public async getM(...keys: string[]) { - const data = await this.redis.hmget(this.hash, ...keys); - return data.map(e => e ? this.decode(e) : null); - } - public async set(key: string, value: T) { const size = await this.redis.hlen(this.hash); if (this.maxSize && size >= this.maxSize) await this.empty(); @@ -162,10 +152,6 @@ export class RedisStore implements IStore { return count > 0; } - public deleteM(...keys: string[]) { - return this.redis.hdel(this.hash, ...keys); - } - public async findKey(cb: StoreSingleEntryCallback) { for await (const [key, value] of this) { if (cb(value, key)) return key; @@ -220,13 +206,10 @@ export class RedisStore implements IStore { } public async map(cb: StoreMapCallback) { - const raw = await this.redis.hgetall(this.hash); - return Object - .entries(raw) - .map(([key, value]) => cb( - this.decode(value), - key - )); + const output: V[] = []; + for await (const [key, value] of this) output.push(cb(value, key)); + + return output; } public async empty(cb?: StoreSingleEntryCallback) {