feat(phase4e): batch delete with multi-select

- KeyList: multi-select mode with checkbox toggle
- Batch delete bar shows selected count + delete button
- RedisService: batchDelete using pipeline
- Preload: batchDelete IPC channel
This commit is contained in:
2026-07-04 18:09:01 +08:00
parent ff09f5dc03
commit 4c66263477
6 changed files with 120 additions and 6 deletions
+3
View File
@@ -179,4 +179,7 @@ export function registerIpcHandlers(): void {
ipcMain.handle('redis:memoryUsage', async (_e, id: string, key: string) => {
return redisService.memoryUsage(id, key)
})
ipcMain.handle('redis:batchDelete', async (_e, id: string, keys: string[]) => {
return redisService.batchDelete(id, keys)
})
}
+12
View File
@@ -278,3 +278,15 @@ export async function memoryUsage(id: string, key: string): Promise<number | nul
if (!client) throw new Error(`Client ${id} not found`)
return client.memory('USAGE', key) as Promise<number | null>
}
export async function batchDelete(id: string, keys: string[]): Promise<number> {
const client = clients.get(id)
if (!client) throw new Error(`Client ${id} not found`)
if (keys.length === 0) return 0
const pipeline = client.pipeline()
for (const key of keys) {
pipeline.del(key)
}
const results = await pipeline.exec()
return results?.filter(([err]) => !err).length ?? 0
}