signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
66 lines • 1.52 kB
TypeScript
/**
* Least Recently Used (LRU) cache with size limit
* Automatically evicts oldest entries when size limit is reached
*
* This prevents memory leaks from unbounded Map growth while maintaining
* a Map-compatible interface for easy drop-in replacement.
*
* @example
* ```typescript
* const cache = new LRUCache<string, number[]>(1000);
* cache.set('key1', [1, 2, 3]);
* const value = cache.get('key1'); // [1, 2, 3]
* ```
*/
export declare class LRUCache<K, V> {
private cache;
private maxSize;
constructor(maxSize?: number);
/**
* Set a value in the cache
* Automatically evicts oldest entry if size limit is reached
*/
set(key: K, value: V): void;
/**
* Get a value from cache
* Moves accessed entry to end (marks as recently used)
*/
get(key: K): V | undefined;
/**
* Check if key exists
*/
has(key: K): boolean;
/**
* Delete an entry
*/
delete(key: K): boolean;
/**
* Clear all entries
*/
clear(): void;
/**
* Get current size
*/
get size(): number;
/**
* Iterate over entries (oldest to newest)
*/
forEach(callback: (value: V, key: K) => void): void;
/**
* Get all keys
*/
keys(): K[];
/**
* Get all values
*/
values(): V[];
/**
* Get cache statistics
*/
getStats(): {
size: number;
maxSize: number;
utilizationPercent: number;
};
}
//# sourceMappingURL=lru-cache.d.ts.map