redis load key refactor

This commit is contained in:
SPRINX0\prochazka
2025-05-14 12:44:53 +02:00
parent b16b02c3f1
commit bb076cce5d
5 changed files with 97 additions and 58 deletions

View File

@@ -202,7 +202,8 @@ const driver = {
},
async scanKeys(dbhan, pattern, cursor = 0, count) {
const [nextCursor, keys] = await dbhan.client.scan(cursor, 'MATCH', pattern || '*', 'COUNT', count);
const match = pattern?.match(/[\?\[\{]/) ? pattern : pattern ? `*${pattern}*` : '*';
const [nextCursor, keys] = await dbhan.client.scan(cursor, 'MATCH', match, 'COUNT', count);
const dbsize = await dbhan.client.dbsize();
const keysMapped = keys.map((key) => ({
key,