[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.
https://github.com/NYTimes/Store/blob/c92f2acbf28cc6cf6e7867ea935231fde0a7f3a7/filesystem/src/main/java/com/nytimes/android/external/fs3/FileSystemRecordPersister.java#L58 here's where I'd do the deletion when a stale record comes back
@digitalbuddha Thanks!