@firecms/core
Version:
Awesome Firebase/Firestore-based headless open-source CMS
24 lines (23 loc) • 1.05 kB
TypeScript
/**
* Saves data to the in-memory cache and persists it individually in `localStorage`.
* @param path - The unique path/key for the data.
* @param data - The data to cache and persist.
*/
export declare function saveEntityToCache(path: string, data: object): void;
/**
* Retrieves an entity from the in-memory cache or `localStorage`.
* If the entity is not in the cache but exists in `localStorage`, it loads it into the cache.
* @param path - The unique path/key for the entity.
* @returns The cached entity or `undefined` if not found.
*/
export declare function getEntityFromCache(path: string): object | undefined;
export declare function hasEntityInCache(path: string): boolean;
/**
* Removes an entity from both the in-memory cache and `localStorage`.
* @param path - The unique path/key for the entity to remove.
*/
export declare function removeEntityFromCache(path: string): void;
/**
* Clears the entire in-memory cache and removes all related entities from `localStorage`.
*/
export declare function clearEntityCache(): void;