google / google/ExoPlayer

SimpleCache: Try and retain UID if platform deletes from cache directory

Open
#8,619 4 comments 0 reactions 1 assignee Assigned to @marcbaechinger View on GitHub
enhancement low priority
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I see that `SimpleCache` creates a uid file in its cache dir. Also it has its own database to keep the list of files that are actually cached. That makes me wonder if `SimpleCache` is really compatible with `context.getCacheDir()`. What will happen when the OS removes all/parts of the files in cache directory? Does android delete files all togheter or it may delete some of them, probably that uid file, while keeping the reset.

```java
File cacheDir = new File(context.getCacheDir(), "TrackPlayer");
DatabaseProvider db = new ExoDatabaseProvider(context);
cache = new SimpleCache(cacheDir, new LeastRecentlyUsedCacheEvictor(cacheMaxSize), db);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.