Cache and temporary storage eviction
The system may delete cache and temporary files when storage runs low; other files stay.
In one line
Can store temporary files that the system may delete when your storage runs low
The system may delete cache and temporary files when storage runs low; other files stay.
Apps cannot rely on cache data staying. Android clears cache dirs and reports a cache quota; iOS purges Caches and tmp when space is needed, and flags files as purgeable.
What it can and can't do
What the user does: Nothing. The app saves cache files while you use it
It can
- Save cache and temporary files, such as image thumbnails
- Keep them until storage runs low or you clear them
- Rebuild them after the system deletes them
It cannot
- Keep cache forever; Android clears oldest cache first when space is low
- Count on cache staying while iPhone is low on storage; it is purged when the app is not running
- Lose Documents or Application Support files on iPhone from this purge
- Stop you from using Settings, then Storage, then Clear cache on Android
How it differs between platforms: Android sets a cache quota and clears oldest first. iPhone purges the caches folder while the app is not running.
On Android and iPhone
| Android | iPhone | |
|---|---|---|
| Status | Supported | Supported |
| First version | Android 8.0 (API 26) | iOS 5.0 |
| Permission or entitlement | None | None |
| Protection level | none | none |
| How access is granted | none | none |
| What the user sees | Settings > Storage > Clear cache | None |
| How long it lasts | Cache cleared on low storage or by the user; per app cache quota via StorageManager | Caches and tmp purged by the system when low; Documents is not |
| How to take it back | Settings | Not user controlled |
| Store policy | None listed | None listed |
| API | Context.getCacheDir(), StorageManager.getCacheQuotaBytes() | FileManager caches directory, volumeAvailableCapacityForImportantUsage |
| Notes | Low storage clears oldest cache first; quota set by the system | Purge happens while the app is not running; Documents and Application Support are kept |
Data you get
What comes back: Free storage
Shape: integer
How often: Live
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
available_bytes | integer | binary | 0 to device size | 1 byte |
Technical limits
- Cache is not durable
- Free space readings fingerprint lightly
The story
What it is
The phone may delete an app's cache and temporary files when it runs low on space.
For you
When your storage is nearly full, the phone may quietly wipe cached images and temporary files. You may see an app reload things it had already downloaded. Your saved files stay.
For makers
Makers must treat caches as disposable and rebuild them when they vanish. It lets the phone free space without asking you, and makers should not hide needed files in caches.
Where you see it
| Type | Example | Apps |
|---|---|---|
| media | A streaming app loses its cached thumbnails when space is low and downloads them again. | None named |
| social | A photo feed app reloads old images after the phone cleared its cache. | None named |
| maps | A map app re downloads map tiles it used to have stored in cache. | None named |
| games | A game re downloads optional textures but keeps your saved game files safe. | None named |
| music | A music app keeps your downloads in permanent storage so they are not wiped, but cached previews may go. | None named |
| developer | A developer tests low storage to see if the app copes with missing cache. | None named |
Risks
- Lost cache slows apps
- Wrongly stored data can vanish
Android and iPhone in short
- Android: Android clears cache folders and reports a cache quota for each app.
- iPhone: iOS purges Caches and tmp folders when space is needed and flags files as purgeable.
Good uses and abuse
Legitimate uses
- Offline content that can be rebuilt
Known abuse
- Storage size fingerprint
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 2 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 4 | Rough identifying entropy, when known |
History
- 2013-09, iPhone iOS 7: System purges Caches when space is needed
- 2017-08, Android 8.0 (API 26): Cache quota APIs introduced
Related capabilities
Related
- Scoped storage and shared files. Can open its own folder and shared media only, not everyone's files, on Android
- App archiving and offloading. Can remove an unused app but keep your data so a reinstall brings it back
Same idea on the web
- Storage quotas and eviction. Can store only what your browser allows, and may lose it when space is low
- Storage persistence and eviction. Can ask the browser to keep its saved data when space runs low
Sources
How well checked: Based on official documentation.