Skip to content

Commit

Permalink
JT-78303: Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-zatsepin committed Jan 26, 2024
1 parent ab1779a commit f9ef19f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class CaffeinePersistentCache<K : Any, V> private constructor(
return keyVersionIndex.current.size()
}

// PersistentHashMap extensions
private fun <K : Any, V> PersistentHashMap<K, V>.removeKey(key: K) {
update { it.removeKey(key) }
}
Expand All @@ -197,10 +198,12 @@ class CaffeinePersistentCache<K : Any, V> private constructor(
}
}

// Cache extensions
private fun Cache<K, WeightedValueMap<Version, V>>.getVersioned(key: K, version: Version): V? {
return this.getIfPresent(key)?.get(version)
}

// WeightedValueMap extensions
// Returns true if values were changed
private fun WeightedValueMap<Version, V>.removeStaleVersions(currentVersion: Version): Boolean {
if (this.size <= 1) {
Expand Down

0 comments on commit f9ef19f

Please sign in to comment.