redis/node-redis

get data using wildcard

Closed this issue · 1 comments

Motivation

Shall we support get by wildcard?

const result = await redis.get('Test:*');

Basic Code Example

No response

Redis (the server) does not support that, but you can combine SCAN and GET to achieve it

using v4:

for await (const key of client.scan({ MATCH: 'test*' }) {
  await client.get(key);
}

using v5 (pre-release, but I'll leave it here for "documentation purposes.."):

for await (const chunk of client.scan({ MATCH: 'test*' }) {
  await client.mGet(chunk);
}