/// /// /// import { Socket } from "net"; import RedundantServers from "./redundant-servers"; import EventEmitter from "events"; import { MemcacheClientOptions, ErrorFirstCallback, PackedData } from "../types"; import { MemcacheConnection } from "./connection"; import { DefaultLogger } from "memcache-parser"; declare type StoreParams = string | number | Buffer | Record; declare type CommonCommandOption = Readonly<{ noreply?: boolean; }>; declare type StoreCommandOptions = CommonCommandOption & { ignoreNotStored?: boolean; } & Readonly<{ lifetime?: number; compress?: boolean; }>; declare type CasCommandOptions = CommonCommandOption & StoreCommandOptions & Readonly<{ casUniq: number | string; }>; declare type SocketCallback = (socket?: Socket) => void; declare type OperationCallback = (error?: Error | null, data?: Data) => void; export declare type RetrievalCommandResponse = { tokens: string[]; casUniq?: number | string; value: ValueType; }; export declare type CasRetrievalCommandResponse = RetrievalCommandResponse & { casUniq: string | number; }; export declare type StatsCommandResponse = Record<"STAT", Array>>; export declare type MultiRetrievalResponse = Record>; export declare type MultiCasRetrievalResponse = Record>; declare type MultiCasRetrieval = ValueType extends MultiCasRetrievalResponse ? ValueType : CasRetrievalCommandResponse; declare type MultiRetrieval = ValueType extends MultiRetrievalResponse ? ValueType : RetrievalCommandResponse; export declare class MemcacheClient extends EventEmitter { options: MemcacheClientOptions; socketID: number; _logger: DefaultLogger; _servers: RedundantServers; private _packer; private Promise; constructor(options: MemcacheClientOptions); shutdown(): void; send(data: StoreParams | SocketCallback, options?: CommonCommandOption | ErrorFirstCallback, callback?: ErrorFirstCallback): Promise; xsend(data: StoreParams | SocketCallback, options?: StoreCommandOptions): Promise; cmd(data: string, options?: CommonCommandOption, callback?: ErrorFirstCallback): Promise; set(key: string, value: StoreParams, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; add(key: string, value: StoreParams, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; replace(key: string, value: StoreParams, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; append(key: string, value: StoreParams, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; prepend(key: string, value: StoreParams, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; cas(key: string, value: StoreParams, options: CasCommandOptions, callback?: OperationCallback): Promise; delete(key: string, options?: CommonCommandOption | OperationCallback, callback?: OperationCallback): Promise; incr(key: string, value: number, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; decr(key: string, value: number, options?: StoreCommandOptions | OperationCallback, callback?: OperationCallback): Promise; touch(key: string, exptime: string | number, options?: CommonCommandOption | OperationCallback, callback?: OperationCallback): Promise; version(callback?: OperationCallback): Promise; store(cmd: string, key: string, value: StoreParams, options?: Partial | OperationCallback, callback?: OperationCallback): Promise; get(key: string | string[], options?: StoreCommandOptions | OperationCallback>, callback?: OperationCallback>): Promise>; gets(key: string | string[], options?: StoreCommandOptions | OperationCallback>, callback?: OperationCallback>): Promise>; retrieve(cmd: string, key: string[] | string, options?: StoreCommandOptions | OperationCallback, callback?: ErrorFirstCallback): Promise; xretrieve(cmd: string, key: string | string[], options?: StoreCommandOptions): Promise; _send(conn: MemcacheConnection, data: StoreParams | SocketCallback, options: Partial): Promise; _callbackSend(data: StoreParams | SocketCallback, options?: Partial, callback?: ErrorFirstCallback): Promise; _unpackValue(result: PackedData): number | string | Record | Buffer; } export {};