Specify default cache size to 16384 entries, and bump cache size for matter entangler

This commit is contained in:
DBotThePony 2025-03-29 13:39:56 +07:00
parent 2d1c9184f4
commit 072d2187f8
Signed by: DBot
GPG Key ID: DCC23B5715498507
4 changed files with 7 additions and 3 deletions

View File

@ -92,7 +92,7 @@ class MatterEntanglerBlockEntity(blockPos: BlockPos, blockState: BlockState) : M
} }
private inner class InputSlot(container: SlottedContainer, slot: Int) : FilteredContainerSlot(container, slot) { private inner class InputSlot(container: SlottedContainer, slot: Int) : FilteredContainerSlot(container, slot) {
val insertCache = SimpleCache<ItemStackKey, Boolean>(1024L, Duration.ofMinutes(1)) val insertCache = SimpleCache<ItemStackKey, Boolean>(Duration.ofMinutes(1))
override fun canAutomationPlaceItem(itemStack: ItemStack): Boolean { override fun canAutomationPlaceItem(itemStack: ItemStack): Boolean {
if (!super.canAutomationPlaceItem(itemStack)) if (!super.canAutomationPlaceItem(itemStack))

View File

@ -202,7 +202,7 @@ sealed class AbstractPoweredFurnaceBlockEntity<P : AbstractCookingRecipe, S : Ma
companion object { companion object {
// shared by all furnace instances, so cache should be large enough // shared by all furnace instances, so cache should be large enough
private val acceptableItems = SimpleCache<ItemStackKey, Boolean>(16384L, Duration.ofMinutes(1)) private val acceptableItems = SimpleCache<ItemStackKey, Boolean>(Duration.ofMinutes(1))
} }
} }

View File

@ -127,6 +127,6 @@ class PlatePressBlockEntity(
} }
companion object { companion object {
private val cache = SimpleCache<ItemStackKey, Boolean>(16384L, Duration.ofMinutes(1L)) private val cache = SimpleCache<ItemStackKey, Boolean>(Duration.ofMinutes(1L))
} }
} }

View File

@ -610,3 +610,7 @@ fun <K : Any, V> SimpleCache(size: Long, freshness: Duration): Cache<K, V> {
.expireAfterWrite(freshness) .expireAfterWrite(freshness)
.build() .build()
} }
fun <K : Any, V> SimpleCache(freshness: Duration): Cache<K, V> {
return SimpleCache(16384L, freshness)
}