@@ -45,11 +45,17 @@ export class LRUDiskCache<V> implements CacheLayer<string, V>{
45
45
* Subclasses that need to store more than just the time of death should
46
46
* override this.
47
47
*/
48
- protected buildLruData ( timeOfDeath : number , localCacheOptions ?: LocalCacheOptions ) : LRUData {
48
+ protected buildLRUData ( timeOfDeath : number , localCacheOptions ?: LocalCacheOptions ) : LRUData {
49
49
return { timeOfDeath }
50
50
}
51
51
52
- public has = ( key : string ) : boolean => this . lruStorage . has ( key )
52
+ protected getLRU ( ) {
53
+ return this . lruStorage
54
+ }
55
+
56
+ public has ( key : string ) : boolean {
57
+ return this . lruStorage . has ( key )
58
+ }
53
59
54
60
public getStats = ( name = 'disk-lru-cache' ) : LRUStats => {
55
61
const stats = {
@@ -68,7 +74,7 @@ export class LRUDiskCache<V> implements CacheLayer<string, V>{
68
74
return stats
69
75
}
70
76
71
- public get = async ( key : string ) : Promise < V | void > = > {
77
+ public async get ( key : string ) : Promise < V | void > {
72
78
const lruData = this . lruStorage . get ( key )
73
79
this . total += 1
74
80
if ( lruData === undefined ) {
@@ -105,9 +111,9 @@ export class LRUDiskCache<V> implements CacheLayer<string, V>{
105
111
return data
106
112
}
107
113
108
- public set = async ( key : string , value : V , maxAge ?: number , localCacheOptions ?: LocalCacheOptions ) : Promise < boolean > = > {
114
+ public async set ( key : string , value : V , maxAge ?: number , localCacheOptions ?: LocalCacheOptions ) : Promise < boolean > {
109
115
let timeOfDeath = maxAge ? maxAge + Date . now ( ) : NaN
110
- const lruData = this . buildLruData ( timeOfDeath , localCacheOptions )
116
+ const lruData = this . buildLRUData ( timeOfDeath , localCacheOptions )
111
117
this . lruStorage . set ( key , lruData , maxAge ? maxAge : undefined )
112
118
113
119
if ( this . keyToBeDeleted && this . keyToBeDeleted !== key ) {
0 commit comments