aboutsummaryrefslogtreecommitdiff
path: root/utils/getRedisWithPrefix.js
diff options
context:
space:
mode:
Diffstat (limited to 'utils/getRedisWithPrefix.js')
-rw-r--r--utils/getRedisWithPrefix.js13
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