Skip to content

Commit 8e58d42

Browse files
committed
Fix lint
1 parent 7f62e70 commit 8e58d42

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/caches/LRUDiskCache.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ export type LRUData = Record<string, unknown> & { timeOfDeath: number }
1111

1212
export class LRUDiskCache<V> implements CacheLayer<string, V>{
1313

14-
private lock: ReadWriteLock
1514
protected disposed: number
1615
protected hits = 0
1716
protected total = 0
17+
private lock: ReadWriteLock
1818
private lruStorage: LRU<string, LRUData>
1919
private keyToBeDeleted: string
2020

@@ -40,19 +40,6 @@ export class LRUDiskCache<V> implements CacheLayer<string, V>{
4040

4141
}
4242

43-
/**
44-
* Builds the data object that will be stored at the LRU memory storage.
45-
* Subclasses that need to store more than just the time of death should
46-
* override this.
47-
*/
48-
protected buildLRUData(timeOfDeath: number, localCacheOptions?: LocalCacheOptions): LRUData {
49-
return { timeOfDeath }
50-
}
51-
52-
protected getLRU() {
53-
return this.lruStorage
54-
}
55-
5643
public has (key: string): boolean {
5744
return this.lruStorage.has(key)
5845
}
@@ -112,7 +99,7 @@ export class LRUDiskCache<V> implements CacheLayer<string, V>{
11299
}
113100

114101
public async set (key: string, value: V, maxAge?: number, localCacheOptions?: LocalCacheOptions): Promise<boolean> {
115-
let timeOfDeath = maxAge ? maxAge + Date.now() : NaN
102+
const timeOfDeath = maxAge ? maxAge + Date.now() : NaN
116103
const lruData = this.buildLRUData(timeOfDeath, localCacheOptions)
117104
this.lruStorage.set(key, lruData, maxAge ? maxAge : undefined)
118105

@@ -137,6 +124,19 @@ export class LRUDiskCache<V> implements CacheLayer<string, V>{
137124
return !failure
138125
}
139126

127+
/**
128+
* Builds the data object that will be stored at the LRU memory storage.
129+
* Subclasses that need to store more than just the time of death should
130+
* override this.
131+
*/
132+
protected buildLRUData(timeOfDeath: number, localCacheOptions?: LocalCacheOptions): LRUData {
133+
return { timeOfDeath }
134+
}
135+
136+
protected getLRU() {
137+
return this.lruStorage
138+
}
139+
140140
private getPathKey = (key: string): string => {
141141
return join(this.cachePath, key)
142142
}

0 commit comments

Comments
 (0)