From f16b1c2d695c5e88fdd6817b05fb238c1ca7a16e Mon Sep 17 00:00:00 2001 From: "Aleksei.Cherepanov" Date: Mon, 19 Jul 2021 18:27:12 +0300 Subject: [PATCH] Add flag to cache storage to reduce number of disk accesses --- .../kotlin/incremental/storage/CachingLazyStorage.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-common/src/org/jetbrains/kotlin/incremental/storage/CachingLazyStorage.kt b/build-common/src/org/jetbrains/kotlin/incremental/storage/CachingLazyStorage.kt index bd5118562b5..1f11945a828 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/storage/CachingLazyStorage.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/storage/CachingLazyStorage.kt @@ -33,15 +33,19 @@ class CachingLazyStorage( private val valueExternalizer: DataExternalizer ) : LazyStorage { private var storage: PersistentHashMap? = null + private var isStorageFileExist = true private fun getStorageIfExists(): PersistentHashMap? { if (storage != null) return storage + if (!isStorageFileExist) return null + if (storageFile.exists()) { storage = createMap() return storage } + isStorageFileExist = false return null }