@phensley/cldr-utils
Version:
Utilities for cldr-engine packages
19 lines (18 loc) • 579 B
TypeScript
/**
* Links an arrow function to an LRU cache. The function converts
* a string to a value of type T. The string itself is used as
* the cache key.
*
* Examples:
* * Caching a number or date pattern. The cache key is the string
* representation of the pattern.
* * Caching any object that is expensive to create, where the cache
* key identifies the type of object to cache.
*/
export declare class Cache<T> {
private builder;
private storage;
constructor(builder: (s: string) => T, capacity: number);
size(): number;
get(raw: string): T;
}