refactor(simulator): introduce HTTP methods enum
[e-mobility-charging-stations-simulator.git] / src / charging-station / SharedLRUCache.ts
index db5269f5317e83508014ec374d36396f5a6ff856..49c06e90e53cb825433754b3e4a384df956631c4 100644 (file)
@@ -1,9 +1,8 @@
 import LRUCache from 'mnemonist/lru-map-with-delete';
 
-import { Bootstrap } from '../internal';
-import type { ChargingStationConfiguration } from '../types/ChargingStationConfiguration';
-import type { ChargingStationTemplate } from '../types/ChargingStationTemplate';
-import Utils from '../utils/Utils';
+import { Bootstrap } from './internal';
+import type { ChargingStationConfiguration, ChargingStationTemplate } from '../types';
+import { Utils } from '../utils';
 
 enum CacheType {
   CHARGING_STATION_TEMPLATE = 'chargingStationTemplate',
@@ -12,14 +11,14 @@ enum CacheType {
 
 type CacheableType = ChargingStationTemplate | ChargingStationConfiguration;
 
-export default class SharedLRUCache {
+export class SharedLRUCache {
   private static instance: SharedLRUCache | null = null;
   private readonly lruCache: LRUCache<string, CacheableType>;
 
   private constructor() {
     this.lruCache = new LRUCache<string, CacheableType>(
-      Bootstrap.getInstance().numberOfChargingStations +
-        Bootstrap.getInstance().numberOfChargingStationTemplates
+      Bootstrap.getInstance().numberOfChargingStationTemplates +
+        Bootstrap.getInstance().numberOfChargingStations
     );
   }
 
@@ -113,9 +112,9 @@ export default class SharedLRUCache {
       Utils.isNullOrUndefined(chargingStationConfiguration?.configurationKey) === false &&
       Utils.isNullOrUndefined(chargingStationConfiguration?.stationInfo) === false &&
       Utils.isNullOrUndefined(chargingStationConfiguration?.configurationHash) === false &&
-      Utils.isEmptyArray(chargingStationConfiguration?.configurationKey) === false &&
+      Utils.isNotEmptyArray(chargingStationConfiguration?.configurationKey) === true &&
       Utils.isEmptyObject(chargingStationConfiguration?.stationInfo) === false &&
-      Utils.isEmptyString(chargingStationConfiguration?.configurationHash) === false
+      Utils.isNotEmptyString(chargingStationConfiguration?.configurationHash) === true
     );
   }
 }