Skip to content

Re-initialize the cache if the directory was deleted. (#297)#1

Merged
HeterPu merged 1 commit intoHeterPu:masterfrom
google:master
Oct 7, 2019
Merged

Re-initialize the cache if the directory was deleted. (#297)#1
HeterPu merged 1 commit intoHeterPu:masterfrom
google:master

Conversation

@HeterPu
Copy link
Copy Markdown
Owner

@HeterPu HeterPu commented Oct 7, 2019

  • Re-initialize the cache if the directory was deleted.

If the user clears the cache from the Android Settings page, the
DiskBasedCache's root directory is deleted. This means that the app will
be running without a cache until it is restarted and the cache
initialized.
This fix initializes the cache when it finds that the root directory no
longer exists.
Note that the first entry after deletion that is put into the cache is
still lost, the cache is only re-initialized when putting that entry
fails. Adding retries would be more complicated, since we would have to
avoid getting into a loop if creating the root directory fails.

Fixes google#296

* Re-initialize the cache if the directory was deleted.

If the user clears the cache from the Android Settings page, the
DiskBasedCache's root directory is deleted. This means that the app will
be running without a cache until it is restarted and the cache
initialized.
This fix initializes the cache when it finds that the root directory no
longer exists.
Note that the first entry after deletion that is put into the cache is
still lost, the cache is only re-initialized when putting that entry
fails. Adding retries would be more complicated, since we would have to
avoid getting into a loop if creating the root directory fails.

Fixes #296
@HeterPu HeterPu merged commit 00f072d into HeterPu:master Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DiskBasedCache breaks if the user clears app cache while the app is still running.

2 participants