Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions www/docs/en/dev/cordova/storage/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,66 @@ database, and its asynchronous API and search indexes provide performance benefi

IndexedDB is supported by the underlying WebView on all platforms, with known limitations on the `browser` platform.

## Cache Storage

### Overview

The Cache Storage API is a web-standard storage mechanism primarily used for
storing network request and response pairs. It is commonly used to support
resource caching and offline-read scenarios, and is often associated with
Service Worker–based caching strategies.

### Availability in Cordova

Cache Storage is exposed via the standard `window.caches` interface when supported
by the underlying WebView implementation. Availability and behavior depend entirely
on the platform WebView, and the API may not be available on all Cordova platforms
or in all execution contexts.

### Platform behavior and caveats

Behavior of Cache Storage in Cordova applications can differ from typical desktop
browser environments:

- **Android (Chromium WebView):** Behavior is generally similar to Chrome, but may
vary depending on the WebView version shipped with the device.
- **iOS (WKWebView):** Cache Storage persistence is more restrictive, and cached
data may be evicted more aggressively by the system.
- **Origin and scheme sensitivity:** Access to cached data is origin-dependent.
Changes to the application origin, scheme, or WebView implementation may prevent
access to previously stored cache entries.

### Persistence and eviction

Cache Storage should not be considered durable storage. Cached data may be removed
by the operating system or WebView implementation under storage pressure, during
application updates, or when the application is reinstalled.

As with other web storage mechanisms, applications should assume that cached data
can be evicted at any time and should be able to recover gracefully.

### When to use (and when not to)

Cache Storage is appropriate for:

- Caching network resources such as API responses or static assets
- Reducing network usage
- Supporting offline-read or offline-first scenarios

Cache Storage is **not** appropriate for:

- Storing user-generated or business-critical data
- Data that requires guaranteed persistence across app restarts or updates

For structured or durable data storage, consider using IndexedDB instead.


### References

- [MDN: Cache Storage API](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage)
- [MDN: Using the Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache)


### Web browser limitations

The actual behavior may depend on which browser is used.
Expand Down