diff options
| author | Factiven <[email protected]> | 2023-10-22 19:43:17 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-22 19:43:17 +0700 |
| commit | f801f8f422954b884a6541321dba0669ee9d6173 (patch) | |
| tree | e0d5e106b99e9b4e0a4c4bf7bb0464617db85b8d /utils/getRedisWithPrefix.js | |
| parent | Bump @babel/traverse from 7.22.8 to 7.23.2 (#90) (diff) | |
| download | moopa-4.2.0.tar.xz moopa-4.2.0.zip | |
Update v4.2.0 (#93)v4.2.0
Diffstat (limited to 'utils/getRedisWithPrefix.js')
| -rw-r--r-- | utils/getRedisWithPrefix.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/getRedisWithPrefix.js b/utils/getRedisWithPrefix.js index 31a466d..b85589b 100644 --- a/utils/getRedisWithPrefix.js +++ b/utils/getRedisWithPrefix.js @@ -63,6 +63,19 @@ export async function getValuesWithNumericKeys() { return values; } +export async function getKeysWithNumericKeys() { + const allKeys = await redis.keys("*"); // Fetch all keys in Redis + const numericKeys = allKeys.filter((key) => /^\d+$/.test(key)); // Filter keys that contain only numbers + + const values = []; + + for (const key of numericKeys) { + const value = await redis.del(key); + } + + return values; +} + export async function countNumericKeys() { const allKeys = await redis.keys("*"); // Fetch all keys in Redis const numericKeys = allKeys.filter((key) => /^\d+$/.test(key)); // Filter keys that contain only numbers |