diff --git a/modules/events-mod/src/main/typescript/main/cache/EventDataCache.ts b/modules/events-mod/src/main/typescript/main/cache/EventDataCache.ts index 2cc0ebe..7920507 100644 --- a/modules/events-mod/src/main/typescript/main/cache/EventDataCache.ts +++ b/modules/events-mod/src/main/typescript/main/cache/EventDataCache.ts @@ -16,7 +16,6 @@ export namespace EventDataCache { if (force == true || isAnythingUndefined) { log("Initialising global.cache") - // global.cache = new Map, CacheEntry>() global.cache = new LuaTable>() log("Initialising global.DEFAULT_CACHE_DURATION_TICKS") @@ -95,7 +94,9 @@ export namespace EventDataCache { global.cache.delete(key) } } - log(`cache expired items count: ${countExpired}, total: ${countTotal}`) + if (countExpired + countTotal > 0) { + log(`cache expired items count: ${countExpired}, total: ${countTotal}`) + } return expiredData } @@ -130,7 +131,7 @@ export namespace EventDataCache { } - // /** Map a {@link FactorioEventUpdateType} to a {@link FactorioEventUpdate} DTO */ + /** Map a {@link FactorioEventUpdateType} to a {@link FactorioEventUpdate} DTO */ type ConvertToUpdate = TYPE extends "PLAYER" ? PlayerUpdate : TYPE extends "MAP_CHUNK" ? MapChunkUpdate : @@ -138,6 +139,7 @@ export namespace EventDataCache { never + /** Map a {@link FactorioEventUpdateType} to a {@link FactorioEventUpdateKey} */ type ConvertToUpdateKey = TYPE extends "PLAYER" ? PlayerUpdateKey : TYPE extends "MAP_CHUNK" ? MapChunkUpdateKey : @@ -151,7 +153,7 @@ export namespace EventDataCache { & Omit, "updateType"> - /** Make nullable-fields optional, and `updateType` specific */ + /** Make `updateType` specific */ export type CacheData = CacheTyped & Omit, "updateType"> @@ -205,11 +207,11 @@ export namespace EventDataCache { } - function isKeyInstanceOf( - key: CacheKey | undefined, - updateType: TYPE, - ): key is CacheKey { - return key != undefined && key.updateType == updateType - } + // function isKeyInstanceOf( + // key: CacheKey | undefined, + // updateType: TYPE, + // ): key is CacheKey { + // return key != undefined && key.updateType == updateType + // } } diff --git a/modules/events-schema/src/commonMain/kotlin/dev/adamko/kafkatorio/events/schema/factorioEventUpdates.kt b/modules/events-schema/src/commonMain/kotlin/dev/adamko/kafkatorio/events/schema/factorioEventUpdates.kt index b6c393b..67d45ff 100644 --- a/modules/events-schema/src/commonMain/kotlin/dev/adamko/kafkatorio/events/schema/factorioEventUpdates.kt +++ b/modules/events-schema/src/commonMain/kotlin/dev/adamko/kafkatorio/events/schema/factorioEventUpdates.kt @@ -24,7 +24,7 @@ class FactorioEventUpdatePacket( } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ sealed interface FactorioEventUpdateKey { @@ -83,7 +83,7 @@ sealed class FactorioEventUpdate : FactorioEventUpdateKey { } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ sealed interface PlayerUpdateKey : FactorioEventUpdateKey { @@ -128,7 +128,7 @@ data class PlayerUpdate( } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ sealed interface EntityUpdateKey : EntityIdentifiers, FactorioEventUpdateKey { @@ -163,7 +163,7 @@ data class EntityUpdate( } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ sealed interface MapChunkUpdateKey : FactorioEventUpdateKey { @@ -195,4 +195,4 @@ data class MapChunkUpdate( } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */