memcached-node
Version:
Node.js client for memcached
44 lines (43 loc) • 2.23 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from "events";
import { Connection, ConnectionConfig, ConnectionOptions, StoreOptions, RetrieveOptions } from "./connection";
import { Response, StatsResponse } from "./response";
export interface MemcachedOptions {
poolSize: number;
initSize: number;
removeDeadServer: boolean;
timeout: number;
wait: boolean;
waitTimeout: number;
}
export declare type Options = Partial<MemcachedOptions & ConnectionOptions>;
export declare class Memcached extends EventEmitter {
private _connectionId;
private _connectionConfig;
private _connectionPool;
private _options;
constructor(args: ConnectionConfig, options?: Options);
clean(): void;
createPool(): Promise<void[]>;
getConnection(): Connection;
private _getIdleConnections;
private _cmd;
private _getConnection;
createConnection(): Promise<Connection>;
private _handleClose;
private _handleDrop;
get(keys: string | Array<string>, options?: RetrieveOptions): Promise<Response>;
gets(keys: string | Array<string>, options?: RetrieveOptions): Promise<Response>;
set(key: string, value: string | Record<string, any>, options?: StoreOptions): Promise<Response>;
add(key: string, value: string | Record<string, any>, options?: StoreOptions): Promise<Response>;
append(key: string, value: string | Record<string, any>, options?: StoreOptions): Promise<Response>;
prepend(key: string, value: string | Record<string, any>, options?: StoreOptions): Promise<Response>;
replace(key: string, value: string | Record<string, any>, options?: StoreOptions): Promise<Response>;
cas(key: string, value: string | Record<string, any>, casId: number, options?: StoreOptions): Promise<Response>;
delete(key: string): Promise<Response>;
gat(keys: string | Array<string>, expire: number, options?: RetrieveOptions): Promise<Response>;
gats(keys: string | Array<string>, expire: number, options?: RetrieveOptions): Promise<Response>;
touch(key: string, expires: number): Promise<Response>;
stats(): Promise<StatsResponse>;
}
export declare function createPool(args: ConnectionConfig, options?: MemcachedOptions): Memcached;