@inventivetalent/loading-cache
Version:
loading cache based on ben-manes/caffeine and node-cache
24 lines (23 loc) • 1.34 kB
TypeScript
import { AsyncLoader, AsyncMultiLoader, Loader, MultiLoader } from "./loaders";
import { AsyncLoadingCache, LoadingCache, Options, SimpleCache } from "./cache";
import { CompletablePromise } from "./util";
declare class CacheBuilder {
private readonly options;
protected constructor();
expireAfterAccess(expireAfterAccess: number): this;
expireAfterWrite(expireAfterWrite: number): this;
deleteOnExpiration(deleteOnExpiration: boolean): this;
expirationInterval(expirationInterval: number): this;
recordStats(recordStats: boolean): this;
build<K, V>(): SimpleCache<K, V>;
build<K, V>(loader: Loader<K, V>, multiLoader?: MultiLoader<K, V>): LoadingCache<K, V>;
build<K, V>(loader: Loader<K, V>, multiLoader: MultiLoader<K, V>, loadingInternalCache?: (options: Options) => SimpleCache<K, V>): LoadingCache<K, V>;
buildAsync<K, V>(): AsyncLoadingCache<K, V>;
buildAsync<K, V>(loader: AsyncLoader<K, V>, multiLoader?: AsyncMultiLoader<K, V>): AsyncLoadingCache<K, V>;
buildAsync<K, V>(loader: AsyncLoader<K, V>, multiLoader: AsyncMultiLoader<K, V>, loadingInternalCache?: (options: Options) => SimpleCache<K, CompletablePromise<V>>): AsyncLoadingCache<K, V>;
}
export declare class Caches extends CacheBuilder {
private constructor();
static builder(): CacheBuilder;
}
export {};