@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
38 lines • 1.16 kB
TypeScript
import { TreeViewItemMeta } from "../internals/models/index.js";
type DataSourceCacheDefaultConfig = {
/**
* Time To Live for each cache entry in milliseconds.
* After this time the cache entry will become stale and the next query will result in cache miss.
* @default 300_000 (5 minutes)
*/
ttl?: number;
};
export interface DataSourceCache {
/**
* Set the cache entry for the given key.
* @param {string} key The key of type `string`
* @param {TreeViewItemMeta[]} value The value to be stored in the cache
*/
set: (key: string, value: TreeViewItemMeta[]) => void;
/**
* Get the cache entry for the given key.
* @param {string} key The key of type `string`
* @returns {TreeViewItemMeta[]} The value stored in the cache
*/
get: (key: string) => TreeViewItemMeta[] | undefined | -1;
/**
* Clear the cache.
*/
clear: () => void;
}
export declare class DataSourceCacheDefault {
private cache;
private ttl;
constructor({
ttl
}: DataSourceCacheDefaultConfig);
set(key: string, value: TreeViewItemMeta[]): void;
get(key: string): TreeViewItemMeta[] | undefined | -1;
clear(): void;
}
export {};