refactor(simulator): remove unneeded intermediate variable in firmware
[e-mobility-charging-stations-simulator.git] / src / charging-station / SharedLRUCache.ts
index e235c51d1f930a764c1e2ef8198b792711254b31..6b6df2049117f96a6c3df3881a73a1f4c5ae28fa 100644 (file)
@@ -1,5 +1,6 @@
 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';
@@ -16,7 +17,10 @@ export default class SharedLRUCache {
   private readonly lruCache: LRUCache<string, CacheableType>;
 
   private constructor() {
-    this.lruCache = new LRUCache<string, CacheableType>(1000);
+    this.lruCache = new LRUCache<string, CacheableType>(
+      Bootstrap.getInstance().numberOfChargingStationTemplates +
+        Bootstrap.getInstance().numberOfChargingStations
+    );
   }
 
   public static getInstance(): SharedLRUCache {