Skip to content

You are here: Caching API

Caching API

The Caching API provides a standard interface that can be used on iOS platform to manage network cache. This interface enables you to store and retrieve network requests and the corresponding responses.

iOS provides a composite on-disk and in-memory cache allowing an app to reduce its dependence on a network connection and provide faster turnaround for previously cached responses. Further, iOS provides support for accessing resources using the protocols such as ftp://, http://, https://, file:///, data://. iOS does not support response caching for all the protocol implementations. Currently, only http and https requests are cached.

For default sessions, the default value is the shared URL cache object.

The Caching API uses voltmx.cache Namespace and the following API elements.

Function Description Initializes a cache capacity memory and disk with the specified values, which can be invoked as part of the preApp or postApp init of the Volt MX Iris app. Returns memory capacity of the cache in bytes. Returns disk capacity of the cache, in bytes. Returns current size of the on-disk cache in bytes. Returns current size of the in-memory cache, in bytes. Initializes the cacheConfig is a dictionary which configures the cachePolicy and storagePolicy of the cache responses for the request at the app level.

Configure the memory capacity and the disk capacity of the cache by using the function. To set the cache policy and storage policy of the cache responses by using the function. The Cache policy deals with the URL load requests and the storage policy specifies the storage location of the response.

Retrieve the memory capacity of the cache using and the disk capacity of the cache using the To find the current size of the cache on disk, use the, and to find the current size of the cache in memory, use the

To view the functionality of the Caching API in action, download the sample application from the link below. Once the application is downloaded, build and preview the application using the Volt MX App.