configcat-common
Version:
ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.
40 lines • 1.62 kB
TypeScript
import type { LoggerWrapper } from "./ConfigCatLogger";
import { ProjectConfig } from "./ProjectConfig";
/** Defines the interface used by the ConfigCat SDK to store and retrieve downloaded config data. */
export interface IConfigCatCache {
/**
* Stores a data item into the cache.
* @param key A string identifying the data item.
* @param value The data item to cache.
*/
set(key: string, value: string): Promise<void> | void;
/**
* Retrieves a data item from the cache.
* @param key A string identifying the value.
* @returns The cached data item or `null` or `undefined` if there is none.
*/
get(key: string): Promise<string | null | undefined> | string | null | undefined;
}
export interface IConfigCache {
set(key: string, config: ProjectConfig): Promise<void> | void;
get(key: string): Promise<ProjectConfig> | ProjectConfig;
getInMemory(): ProjectConfig;
}
export declare class InMemoryConfigCache implements IConfigCache {
private cachedConfig;
set(_key: string, config: ProjectConfig): void;
get(_key: string): ProjectConfig;
getInMemory(): ProjectConfig;
}
export declare class ExternalConfigCache implements IConfigCache {
private readonly cache;
private readonly logger;
private cachedConfig;
private cachedSerializedConfig;
constructor(cache: IConfigCatCache, logger: LoggerWrapper);
set(key: string, config: ProjectConfig): Promise<void>;
private updateCachedConfig;
get(key: string): Promise<ProjectConfig>;
getInMemory(): ProjectConfig;
}
//# sourceMappingURL=ConfigCatCache.d.ts.map