@launchdarkly/js-server-sdk-common
Version:
LaunchDarkly Server SDK for JavaScript - common code
34 lines • 1.66 kB
TypeScript
import { DataKind, PersistentDataStore } from '../api/interfaces';
import { LDFeatureStore, LDFeatureStoreDataStorage, LDFeatureStoreItem, LDFeatureStoreKindData, LDKeyedFeatureStoreItem } from '../api/subsystems';
/**
* Internal implementation of {@link LDFeatureStore} that delegates the basic functionality to an
* instance of {@link PersistentDataStore}. It provides optional caching behavior and other logic
* that would otherwise be repeated in every data store implementation. This makes it easier to
* create new database integrations by implementing only the database-specific logic.
*/
export default class PersistentDataStoreWrapper implements LDFeatureStore {
private readonly _core;
private _isInitialized;
/**
* Cache for storing individual items.
*/
private _itemCache;
/**
* Cache for storing all items of a type.
*/
private _allItemsCache;
/**
* Used to preserve order of operations of async requests.
*/
private _queue;
constructor(_core: PersistentDataStore, ttl: number);
init(allData: LDFeatureStoreDataStorage, callback: () => void): void;
get(kind: DataKind, key: string, callback: (res: LDFeatureStoreItem | null) => void): void;
initialized(callback: (isInitialized: boolean) => void): void;
all(kind: DataKind, callback: (res: LDFeatureStoreKindData) => void): void;
upsert(kind: DataKind, data: LDKeyedFeatureStoreItem, callback: () => void): void;
delete(kind: DataKind, key: string, version: number, callback: () => void): void;
close(): void;
getDescription(): string;
}
//# sourceMappingURL=PersistentDataStoreWrapper.d.ts.map