Hi,
I tried implementing Raw HTTP cache like so:
val file = File(context.applicationContext.filesDir, "apolloCache")
val cacheSize = 5 * 1024 * 1024 //5mb
val cacheStore = DiskLruHttpCacheStore(file, cacheSize.toLong())
builder.httpCache(ApolloHttpCache(cacheStore))
val cachePolicy = HttpCachePolicy.CACHE_FIRST
cachePolicy.expireAfter(60 * 1000, TimeUnit.MILLISECONDS)
builder.defaultHttpCachePolicy(cachePolicy)
Although I have added that the cache data should expire after 1 minute. After 1 minute has passed I am still getting the cached data. Is this a known issue? or a bug? or just something i am doing wrong?
I am currently using version 1.2.1. I havent tried updating to the latest version.
Thanks
cachePolicy.expireAfter(60 * 1000, TimeUnit.MILLISECONDS)
The return value is lost there. You'll need to keep track of it:
val cachePolicy = HttpCachePolicy.CACHE_FIRST.expireAfter(60 * 1000, TimeUnit.MILLISECONDS)
Silly mistake, the method is not clear. I thought it was a setter.