UNPKG

@keyv/valkey

Version:

Valkey storage adapter for Keyv

35 lines (31 loc) 1.36 kB
import EventEmitter from 'events'; import { Keyv, KeyvStoreAdapter, StoredData } from 'keyv'; import { Redis, Cluster } from 'iovalkey'; type KeyvValkeyOptions = { [K in keyof Redis]?: Redis[K]; } & { uri?: string; dialect?: string; useRedisSets?: boolean; }; type KeyvUriOptions = string | KeyvValkeyOptions | Redis | Cluster; declare const createKeyv: <Value>(uri: KeyvValkeyOptions | KeyvUriOptions, options?: KeyvValkeyOptions) => Keyv<Value>; declare class KeyvValkey extends EventEmitter implements KeyvStoreAdapter { ttlSupport: boolean; namespace?: string; opts: Record<string, unknown>; redis: any; constructor(uri: KeyvValkeyOptions | KeyvUriOptions, options?: KeyvValkeyOptions); _getNamespace(): string; _getKeyName: (key: string) => string; get<Value>(key: string): Promise<StoredData<Value> | undefined>; getMany<Value>(keys: string[]): Promise<Array<StoredData<Value | undefined>>>; set(key: string, value: any, ttl?: number): Promise<undefined>; delete(key: string): Promise<boolean>; deleteMany(keys: string[]): Promise<boolean>; clear(): Promise<void>; iterator(namespace?: string): AsyncGenerator<any[], void, unknown>; has(key: string): Promise<boolean>; disconnect(): Promise<any>; } export { type KeyvValkeyOptions, createKeyv, KeyvValkey as default };