Files
JRedisDesktop/electron/main/redis/set.ts
T
Jokul bdcf4fe299 refactor: restructure project layout
- Move main process to electron/main/
- Move preload to electron/preload/
- Add shared types in electron/shared/
- Split redis-service into modular redis/ directory
- Flatten renderer to src/ (remove src/renderer/ nesting)
- Update electron.vite.config.ts paths
- Update tsconfig paths
- Output to electron-dist/
2026-07-04 21:12:50 +08:00

28 lines
923 B
TypeScript

// src/main/redis/set.ts
// Set 操作
import { getClient } from './connection'
export async function setMembers(id: string, key: string): Promise<string[]> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return client.smembers(key)
}
export async function setSize(id: string, key: string): Promise<number> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return client.scard(key)
}
export async function setAdd(id: string, key: string, ...members: string[]): Promise<number> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return client.sadd(key, ...members)
}
export async function setRemove(id: string, key: string, ...members: string[]): Promise<number> {
const client = getClient(id)
if (!client) throw new Error(`Client ${id} not found`)
return client.srem(key, ...members)
}