-
Notifications
You must be signed in to change notification settings - Fork 305
RecordPersister's 'Expiration' is not working #372
Comments
What's in |
@ychescale9 thanks for looking into this
Should memory policy have any affect on this? Also I can not create a a new project at the moment. If it helps I can remove the memory policy and resubmit my new findings. |
I am seeing exactly the same (using |
@gaurav-m I think I fixed that thing for me now by using private val DEALS_EXPIRE_AFTER_WRITE = 1L
private val DEALS_EXPIRE_AFTER_WRITE_UNIT = TimeUnit.MINUTES
StoreBuilder.parsedWithKey<Int, BufferedSource, DealsResponse>()
.fetcher {
dealsDataSource.getDeals().subscribeOn(Schedulers.io())
}
.persister(
FileSystemPersisterFactory.create(
FileSystemFactory.create(application.filesDir),
{ generateKey(it) },
DEALS_EXPIRE_AFTER_WRITE,
DEALS_EXPIRE_AFTER_WRITE_UNIT
)
)
.parser(GsonParserFactory.createSourceParser(gson, DealsResponse::class.java))
.memoryPolicy(
MemoryPolicy.builder()
.setExpireAfterTimeUnit(DEALS_EXPIRE_AFTER_WRITE_UNIT)
.setExpireAfterWrite(DEALS_EXPIRE_AFTER_WRITE)
.build()
)
.networkBeforeStale() // not entirely sure whether this is actually needed
.open() @ychescale9 I'm not entirely sure whether the |
@gaurav-m https://github.com/NYTimes/Store/blob/e4c21b23c80ba1c6a2f5c451066ed7adff3592f0/store/src/main/java/com/nytimes/android/external/store3/base/impl/RealInternalStore.java#L146 Looks like it only applies to persister, but once your memory cache becomes expired (defined by the Sorry I'm not familiar with the filesystem based persisters so not sure if they have any behavior that might be "unexpected". |
Hello, I have trouble understanding your issue. A store should not return stale data if you are using Could you mutate the tests to show what your issue is? |
@digitalbuddha with @gaurav-m can you check what type your |
@ubuntudroid i'll check and get back. will do that in couple of days. apologies for the delay. I stopped following this a while back. |
Data is fetched from the disk(not from network) even after the expiation time(here 1 minute).
Note : I am force killing the application and re-launching, so memory data is not used.
I even tried adding
networkBeforeStale()
But no change.
I read everything I could find online around this. So far no progress.
*Fresh data from network is fetched after i do this
Device Settings -> Applictions -> My Application -> Clear Cache
The text was updated successfully, but these errors were encountered: