File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
// @see https://www.npmjs.com/package/lru-cache
2
-
2
+ type DisposeReason = 'set' | 'delete' | 'evict' | 'expired' ;
3
3
export interface LRUCacheOptions < K = string , V = unknown > {
4
4
/** The maximum number of items that remain in the cache. default 500 */
5
5
max ?: number ;
6
6
/** how long to live in ms. default 0 */
7
7
ttl ?: number ;
8
8
updateAgeOnGet ?: boolean ;
9
9
/** Function that is called on items when they are dropped from the cache */
10
- dispose ?( val : LRUCacheItem < V > , key : K , reason : string ) : void ;
10
+ dispose ?( val : LRUCacheItem < V > , key : K , reason : DisposeReason ) : void ;
11
11
}
12
12
13
13
interface LRUCacheItem < V > {
@@ -65,7 +65,7 @@ export class LRUCache<K = string, V = unknown> {
65
65
return value . v as T ;
66
66
}
67
67
/** Deletes a key out of the cache */
68
- delete ( key : K , reason = 'delete' ) {
68
+ delete ( key : K , reason : DisposeReason = 'delete' ) {
69
69
if ( ! this . cache . has ( key ) ) return false ;
70
70
const val = this . cache . get ( key ) ;
71
71
this . cache . delete ( key ) ;
You can’t perform that action at this time.
0 commit comments