nytimes / Store

Android Library for Async Data Loading and Caching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] What happens with stale records on disk ?

bobymicroby opened this issue · comments

Hello @digitalbuddha

I've barely red the sources, but as far as I can see stale records are not cleaned from disk and this will be a problem at some point. Do the Store provide any mechanism for cleaning stale data on disk ?

P.S I just found out that FileSystemRecordPersister which i was using didn't implement clearable, so there is no way to actually delete the records from the FS.

If you implement 'clearable' in your persister then you can call store.clear(key). Of not then you can have your own persister implementation and deal with clearing it yourself.

@digitalbuddha Sure, that handles explicit clearing of items with .clear() , but if an item expires from memory which get's cleared implicitly, it will still be present on disk.

It would. This is similar to how a database works. If you implement a stale aware persister you can handle deletion when you tell Store that a record is stale.