@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
29 lines (28 loc) • 1.06 kB
TypeScript
export declare const enum CacheInvalidationEventType {
Full = "full"
}
export type CacheInvalidationEvent = {
type: CacheInvalidationEventType.Full;
};
export interface CacheInvalidationEventReceiver {
receive(event: CacheInvalidationEvent): void;
}
/**
* Central class for caching analysis results in FlowR.
*/
export declare abstract class FlowrCache<Cache> implements CacheInvalidationEventReceiver {
private value;
private dependents;
registerDependent(dependent: CacheInvalidationEventReceiver): void;
removeDependent(dependent: CacheInvalidationEventReceiver): void;
receive(event: CacheInvalidationEvent): void;
/**
* Notify all dependents of a cache invalidation event.
*/
notifyDependents(event: CacheInvalidationEvent): void;
/**
* Get the cached value or compute it if not present.
* This will, by default, not trigger any {@link notifyDependents} calls, as this is only a cache retrieval.
*/
protected computeIfAbsent(force: boolean | undefined, compute: () => Cache): Cache;
}