Skip to content

Commit

Permalink
upon clearing the ks object cache, clear retained thread locals
Browse files Browse the repository at this point in the history
  • Loading branch information
kaeawc authored and ting-yuan committed Oct 16, 2024
1 parent 6633a43 commit 00d6f42
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class KSObjectCacheManager {
get() = caches_prop.get()

fun register(cache: KSObjectCache<*, *>) = caches.add(cache)
fun clear() = caches.forEach { it.clear() }
fun clear() {
caches.forEach { it.clear() }
caches_prop.remove()
}
}
}

Expand All @@ -44,5 +47,8 @@ abstract class KSObjectCache<K, V> {
return cache_prop.get()
}

open fun clear() = cache.clear()
open fun clear() {
cache.clear()
cache_prop.remove()
}
}

0 comments on commit 00d6f42

Please sign in to comment.