perf(redis): reduce fetch-all rendering overhead

This commit is contained in:
Guoyu Su authored and GitHub committed 2026-07-22 17:45:54 +08:00
1 parent a81d6da604
commit 2fa4ffd074
5 files changed
+117 -35

No files matched your search

@@ -0,0 +1,13 @@
import type { RedisKeyInfo } from "@/lib/backend/api";
export function collectUniqueRedisKeys(keys: RedisKeyInfo[], loadedKeyRaws: Set<string>): RedisKeyInfo[] {
const uniqueKeys: RedisKeyInfo[] = [];
for (const key of keys) {
if (loadedKeyRaws.has(key.key_raw)) continue;
loadedKeyRaws.add(key.key_raw);
uniqueKeys.push(key);
}
return uniqueKeys;
}