From 8e58d42be372342be3818790399345075e360a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mai=CC=81ra=20Bello?= Date: Wed, 8 Nov 2023 10:56:59 -0300 Subject: [PATCH] Fix lint --- src/caches/LRUDiskCache.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/caches/LRUDiskCache.ts b/src/caches/LRUDiskCache.ts index 2dd57b0c..c5587306 100644 --- a/src/caches/LRUDiskCache.ts +++ b/src/caches/LRUDiskCache.ts @@ -11,10 +11,10 @@ export type LRUData = Record & { timeOfDeath: number } export class LRUDiskCache implements CacheLayer{ - private lock: ReadWriteLock protected disposed: number protected hits = 0 protected total = 0 + private lock: ReadWriteLock private lruStorage: LRU private keyToBeDeleted: string @@ -40,19 +40,6 @@ export class LRUDiskCache implements CacheLayer{ } - /** - * Builds the data object that will be stored at the LRU memory storage. - * Subclasses that need to store more than just the time of death should - * override this. - */ - protected buildLRUData(timeOfDeath: number, localCacheOptions?: LocalCacheOptions): LRUData { - return { timeOfDeath } - } - - protected getLRU() { - return this.lruStorage - } - public has (key: string): boolean { return this.lruStorage.has(key) } @@ -112,7 +99,7 @@ export class LRUDiskCache implements CacheLayer{ } public async set (key: string, value: V, maxAge?: number, localCacheOptions?: LocalCacheOptions): Promise { - let timeOfDeath = maxAge ? maxAge + Date.now() : NaN + const timeOfDeath = maxAge ? maxAge + Date.now() : NaN const lruData = this.buildLRUData(timeOfDeath, localCacheOptions) this.lruStorage.set(key, lruData, maxAge ? maxAge : undefined) @@ -137,6 +124,19 @@ export class LRUDiskCache implements CacheLayer{ return !failure } + /** + * Builds the data object that will be stored at the LRU memory storage. + * Subclasses that need to store more than just the time of death should + * override this. + */ + protected buildLRUData(timeOfDeath: number, localCacheOptions?: LocalCacheOptions): LRUData { + return { timeOfDeath } + } + + protected getLRU() { + return this.lruStorage + } + private getPathKey = (key: string): string => { return join(this.cachePath, key) }