UNPKG

@firecms/core

Version:

Awesome Firebase/Firestore-based headless open-source CMS

28 lines (27 loc) 1.39 kB
/** * 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; export declare function removeEntityFromMemoryCache(path: string): void; export declare function saveEntityToMemoryCache(path: string, data: object): void; export declare function getEntityFromMemoryCache(path: string): object | undefined; export declare function hasEntityInCache(path: string): boolean; /** * 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; /** * 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; export declare function flattenKeys(obj: any, prefix?: string, result?: string[]): string[];