// 服务器操作 import { getClient } from './connection' export async function execute(id: string, command: string, args: string[]): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) return client.call(command, ...args) } export async function getServerInfo(id: string): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) return client.info() as Promise } export async function selectDb(id: string, db: number): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) await client.select(db) } export async function dbSize(id: string): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) return client.dbsize() as Promise } export async function ping(id: string): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) return client.ping() } export async function slowLogGet(id: string, count: number): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) return client.slowlog('GET', count) as Promise } export async function slowLogLen(id: string): Promise { const client = getClient(id) if (!client) throw new Error(`Client ${id} not found`) return client.slowlog('LEN') as Promise }