DiskLruCache
DiskLruCache copied to clipboard
Avoid IOExceptions in delete() when the cache dir is deleted externally.
File#listFiles() will return null if the directory has been deleted. This
scenario isn’t totally far fetched because it’s fairly common for
Android developers to place their disk caches in the Android application
cache directory. The cache directory can be cleared at any time by the
system, including while the app is open, which in turn can cause
unexpected IOExceptions when delete() is called.
See https://github.com/bumptech/glide/issues/2465 for additional context.