UNPKG

@leyyo/cache

Version:
30 lines (29 loc) 1.81 kB
import { Id, KeyAny, TR } from "../types"; import { CacheSet, CacheSetDef, CacheSetSecure } from "./types"; import { CacheInvalidator, CacheInvalidatorResult } from "../invalidator"; import { CacheFormat } from "../format"; import { CacheChannel, CacheChannelProp, CacheChannelPropSecure } from "../channel"; import { CacheResultBoolean, CacheResultNumber } from "../command"; export declare abstract class CacheSetAbstract<A extends TR, N extends Id> implements CacheSet<A, N>, CacheSetSecure<A, N> { protected readonly channel: CacheChannel<A, N>; protected format: CacheFormat<A, N>; protected invalidator: CacheInvalidator<A>; protected prop: Readonly<CacheChannelProp<A>>; protected check: CacheChannelPropSecure<A>; protected constructor(channel: CacheChannel<A, N>); add(key: KeyAny, members: Array<N>): Promise<CacheInvalidatorResult<A, CacheResultNumber>>; existMore(key: KeyAny, members: Array<N>): Promise<CacheInvalidatorResult<A, Array<CacheResultBoolean>>>; exists(key: KeyAny, member: N): Promise<CacheInvalidatorResult<A, CacheResultBoolean>>; getLength(key: KeyAny): Promise<CacheInvalidatorResult<A, CacheResultNumber>>; listMembers(key: KeyAny): Promise<CacheInvalidatorResult<A, Array<string>>>; remove(key: KeyAny, members: Array<N>): Promise<CacheInvalidatorResult<A, CacheResultNumber>>; get $flat(): CacheSetDef; get $secure(): CacheSetSecure<A, N>; get $back(): CacheSet<A, N>; $init(): void; abstract $add(key: string, members: Array<string>): Promise<number>; abstract $exist(key: string, member: string): Promise<boolean>; abstract $length(key: string): Promise<number>; abstract $list(key: string): Promise<Array<string>>; abstract $remove(key: string, members: Array<string>): Promise<number>; }