Replies: 1 comment 1 reply
-
In case you use transformations you'll probably want to do something like: @OptIn(ExperimentalCoilApi::class)
fun clearCache(context: Context, data: Any, memory: Boolean = true, file: Boolean = true) {
val imageLoader = context.imageLoader
if (memory) {
val key = imageLoader.components.key(data, Options(context)) ?: return
val cacheKey = imageLoader.memoryCache.keys.find { it.key == key } ?: return
imageLoader.memoryCache?.remove(cacheKey)
}
if (file) {
imageLoader.diskCache?.remove(data.toString())
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I remove all cached images belonging to an item currently? In all possible variations?
What I have so far is following:
I want to remove cached data for ANY options - is that possible?
Beta Was this translation helpful? Give feedback.
All reactions