Type Alias Options<KeyType, ValueType>
Options: {
maxAge?: number;
maxSize: number;
onEviction?: (key: KeyType, value: ValueType) => void;
}
maxAge?: number;
maxSize: number;
onEviction?: (key: KeyType, value: ValueType) => void;
}
Type Parameters
Type declaration
Optional
Readonly
maxAge?: numberReadonly
maxSize: numberThe maximum number of items before evicting the least recently used items.
Optional
onEviction?: (key: KeyType, value: ValueType) => voidCalled right before an item is evicted from the cache.
Useful for side effects or for items like object URLs that need explicit cleanup (
revokeObjectURL
).
The maximum number of milliseconds an item should remain in the cache.