Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Managing Cached Data

Managing Cached Data

With caching, two types of data are stored: the actual content type items and metadata that is entirely managed by the SDK. You can control where this data is written as well as clear the cache when needed.

This article is organized as follows:

Where Cached Data is Stored

Caching shares storage and storage settings with Offline Support. This ensures that the same data is not stored twice on the device in case you enable both caching and offline mode.

To change the storage settings, use the offline object as discussed in Initializing Offline Mode.

For example:

el = new Everlive({
            offline: {
                enabled: false,
                storage: {
                    provider: Everlive.Constants.StorageProvider.FileSystem
                }
            },
            caching: true
});

Besides choosing a storage provider, the example shows how to use caching without using offline modeā€”set caching to true and offline.enabled to false.

Persistence

Cached data is preserved between app restarts. If you want to, you could call the clearAll method on application exit to ensure that cached data is deleted.

If you don't want to clear the cache but want to secure the data, you can encrypt the offline storage as discussed in Data Security in Offline Mode.

Clearing the Cache

You may need to delete cached content in case it starts to fill up the device's storage space. While the caching metadata is expected to take very little space, the size of the content type items may vary considerably.

You can clear a single content type or the entire cache.

Clear Cache for a Single Content Type

Use the cache.clear method to clear cached data for a single content type:

el.cache.clear(contentTypeName, successFunction, errorFunction);

Clear All Cache Content

Use the cache.clearAll method to clear all content types from the cache:

el.cache.clearAll(successFunction, errorFunction);

If offline mode is enabled and you select to clear the entire cache, only the caching metadata is cleared. Otherwise both the metadata and the content type data is cleared.

Using offline mode's purge and purgeAll also clears the cache.

See Also

Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.