https://kotlinlang.org logo
#ktor
Title
# ktor
a

aliftc12

11/13/2023, 8:35 AM
Hi, I'm currently using Ktor as the HTTP client in my application. In OkHttp, there's a feature called 'pruning the HTTP cache. Is there an equivalent functionality or recommended approach in Ktor to achieve similar cache pruning for HTTP requests? I am using io.ktor.client.plugins.cache.HttpCache
a

Aleksei Tirman [JB]

11/14/2023, 8:24 AM
In other words, you want to evict all cache entries, right?
a

aliftc12

11/15/2023, 1:10 PM
correct @Aleksei Tirman [JB]
a

Aleksei Tirman [JB]

11/15/2023, 1:10 PM
Unfortunately, that's not possible.
a

aliftc12

11/15/2023, 1:36 PM
Is there any workaround @Aleksei Tirman [JB]? maybe like recreating instance of ktor client?
a

Aleksei Tirman [JB]

11/15/2023, 1:45 PM
If you use the file storage then you can delete the files to prune the cache.
a

aliftc12

11/15/2023, 2:20 PM
Ok I will try it. Thank you @Aleksei Tirman [JB]