X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FSharedLRUCache.ts;h=ba0a47d59b70962ab75517aab0215dda6b0b3424;hb=ca47912d4ef0ca7608be49e62aadb6a931d74359;hp=b58dc79ee6a9509c3fc5a79bf4605487b500d174;hpb=b768993dd4636df8276b0ea47158dd9bdc9a997b;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/SharedLRUCache.ts b/src/charging-station/SharedLRUCache.ts index b58dc79e..ba0a47d5 100644 --- a/src/charging-station/SharedLRUCache.ts +++ b/src/charging-station/SharedLRUCache.ts @@ -1,6 +1,6 @@ import LRUCache from 'mnemonist/lru-map-with-delete.js'; -import { Bootstrap } from './internal'; +import { Bootstrap } from './Bootstrap'; import type { ChargingStationConfiguration, ChargingStationTemplate } from '../types'; import { Utils } from '../utils'; @@ -9,14 +9,14 @@ enum CacheType { chargingStationConfiguration = 'chargingStationConfiguration', } -type CacheableType = ChargingStationTemplate | ChargingStationConfiguration; +type CacheValueType = ChargingStationTemplate | ChargingStationConfiguration; export class SharedLRUCache { private static instance: SharedLRUCache | null = null; - private readonly lruCache: LRUCache; + private readonly lruCache: LRUCache; private constructor() { - this.lruCache = new LRUCache( + this.lruCache = new LRUCache( Bootstrap.getInstance().numberOfChargingStationTemplates + Bootstrap.getInstance().numberOfChargingStations ); @@ -93,11 +93,11 @@ export class SharedLRUCache { return this.lruCache.has(key); } - private get(key: string): CacheableType | undefined { + private get(key: string): CacheValueType | undefined { return this.lruCache.get(key); } - private set(key: string, value: CacheableType): void { + private set(key: string, value: CacheValueType): void { this.lruCache.set(key, value); } @@ -111,9 +111,12 @@ export class SharedLRUCache { return ( Utils.isNullOrUndefined(chargingStationConfiguration?.configurationKey) === false && Utils.isNullOrUndefined(chargingStationConfiguration?.stationInfo) === false && + Utils.isNullOrUndefined(chargingStationConfiguration?.automaticTransactionGenerator) === + false && Utils.isNullOrUndefined(chargingStationConfiguration?.configurationHash) === false && Utils.isNotEmptyArray(chargingStationConfiguration?.configurationKey) === true && Utils.isEmptyObject(chargingStationConfiguration?.stationInfo) === false && + Utils.isEmptyObject(chargingStationConfiguration?.automaticTransactionGenerator) === false && Utils.isNotEmptyString(chargingStationConfiguration?.configurationHash) === true ); }