UNPKG

dla

Version:

node.js data loader with caching and support of lists

37 lines (36 loc) 1.23 kB
import { Cache } from './cache'; import * as Types from './shared-types'; export declare class PrefixCache<V> extends Cache<V> { origin: Types.ICache<V>; prefix: string; constructor(prefix: string, origin: Types.ICache<V>); has(key: string): Promise<boolean>; get(key: string): Promise<V>; set(key: string, value: V, options: Types.IOptionsTTL): Promise<void>; setnx(key: string, value: V, options: Types.IOptionsTTL): Promise<void>; remove(key: string): Promise<void>; mhas(keys: string[]): Promise<{ [key: string]: boolean; }>; mget(keys: string[]): Promise<{ [key: string]: V; }>; mset(few: { [key: string]: V; }): Promise<void>; msetnx(few: { [key: string]: V; }): Promise<void>; mremove(keys: string[]): Promise<void>; load(key: string, loader: () => Types.SyncOrAsync<V>, options?: { fast?: boolean; }): Promise<V>; mload(keys: string[], loader: (keys: string[]) => Types.SyncOrAsync<{ [id: string]: V; }>, options: { fast?: boolean; }): Promise<{ [id: string]: V; }>; } export declare function prefixCache<V>(prefix: string, origin: Types.ICache<V>): PrefixCache<V>;