@optimizely/optimizely-sdk
Version:
JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts
39 lines (38 loc) • 1.36 kB
TypeScript
import { LoggerFacade } from "../logging/logger";
import { AsyncStore, AsyncStoreWithBatchedGet, Store } from "../utils/cache/store";
import { Maybe } from "../utils/type";
import { EventWithId } from "./batch_event_processor";
import { Platform } from '../platform_support';
export type StoredEvent = EventWithId & {
_time?: {
storedAt: number;
ttl: number;
};
};
export declare const DEFAULT_MAX_EVENTS_IN_STORE = 500;
export declare const DEFAULT_STORE_TTL: number;
export declare const EVENT_STORE_PREFIX = "optly_event:";
export type EventStoreConfig = {
maxSize?: number;
ttl?: number;
store: Store<EventWithId>;
logger?: LoggerFacade;
};
export declare class EventStore extends AsyncStoreWithBatchedGet<EventWithId> implements AsyncStore<EventWithId> {
readonly operation = "async";
private store;
private serializer;
private logger?;
private maxSize;
private ttl;
private keys?;
constructor(config: EventStoreConfig);
private readKeys;
set(key: string, event: EventWithId): Promise<unknown>;
private processStoredEvent;
get(key: string): Promise<EventWithId | undefined>;
remove(key: string): Promise<unknown>;
getKeys(): Promise<string[]>;
getBatched(keys: string[]): Promise<Maybe<EventWithId>[]>;
}
export declare const __platforms: Platform[];