@leyyo/cache
Version:
Common cache library
38 lines (37 loc) • 1.82 kB
TypeScript
import { CacheChannel } from "../channel";
import { FieldId, FieldIddArray, Id, IdAny, IdAnyArray, IdArray, IdType, OneOrMore, TR } from "../types";
import { CacheFormat, CacheFormatBasics, CacheFormatRec, CacheFormatRecs, CacheFormatSecure } from "./types";
import { CacheFieldValue } from "../hash";
export declare abstract class CacheFormatAbstract<A extends TR, N extends Id> implements CacheFormat<A, N>, CacheFormatSecure<A, N> {
protected channel: CacheChannel<A, N>;
protected readonly prefixes: Record<IdType, string>;
protected constructor(channel: CacheChannel<A, N>);
private _trim;
private _toPlain;
private _toPlainList;
private _toDelimited;
private _buildFull;
private _fullId;
private _fullIds;
protected abstract _fullValue(delim: string, short: string): string;
checkName<A>(property: OneOrMore<string | keyof A>): Array<string>;
key(key: IdAny): CacheFormatRec;
keys(keys: IdAnyArray): CacheFormatRecs;
basic(id: IdAny): string;
basics(ids: IdAnyArray): Array<string>;
alias(alias: IdAny): CacheFormatRec;
aliases(aliases: IdAnyArray): CacheFormatRecs;
owner(owner: IdAny): CacheFormatRec;
owners(owners: IdAnyArray): CacheFormatRecs;
invalidation(invalidation: IdAny): CacheFormatRec;
invalidations(invalidations: IdAnyArray): CacheFormatRecs;
field(field: Id | FieldId<A>): string;
fields(fields: IdArray | FieldIddArray<A>): Array<string>;
member(member: Id): string;
members(members: IdArray): Array<string>;
memberShorts(members: IdArray): CacheFormatBasics;
value(value: CacheFieldValue<A>): CacheFieldValue<A>;
valueDoc(value: Record<string, CacheFieldValue<A>>): Record<string, CacheFieldValue<A>>;
get $back(): CacheFormat<A, N>;
get $secure(): CacheFormatSecure<A, N>;
}