Managing Cache
import { Flagship, IHitCacheImplementation, IVisitorCacheImplementation } from "@flagship.io/js-sdk";
class HitCache implements IHitCacheImplementation {
cacheHit(hits: Record<string, HitCacheDTO>): Promise<void> {
// store hits in the cache
throw new Error("Method not implemented.");
}
lookupHits(): Promise<Record<string, HitCacheDTO>> {
// retrieve hits from the cache
throw new Error("Method not implemented.");
}
flushHits(hitKeys: string[]): Promise<void> {
// remove hits from the cache
throw new Error("Method not implemented.");
}
flushAllHits(): Promise<void> {
// remove all hits from the cache
throw new Error("Method not implemented.");
}
}
class VisitorCache implements IVisitorCacheImplementation{
cacheVisitor(visitorId: string, Data: VisitorCacheDTO): Promise<void> {
// store visitor data in the cache
throw new Error("Method not implemented.");
}
lookupVisitor(visitorId: string): Promise<VisitorCacheDTO> {
// retrieve visitor data from the cache
throw new Error("Method not implemented.");
}
flushVisitor(visitorId: string): Promise<void> {
// remove visitor data from the cache
throw new Error("Method not implemented.");
}
}
Flagship.start("<ENV_ID>", "<API_KEY>", {
hitCacheImplementation: new HitCache(),
visitorCacheImplementation: new VisitorCache(),
});
Last updated
Was this helpful?

