WidgetCache

The WidgetCache object provides functions and properties to control application Caching behavior.


Supported Platform(s)

- BlackBerry OS 5.0+
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
blackberry.widgetcache.clearAll Y Y Y       
blackberry.widgetcache.clearCache Y Y Y       
blackberry.widgetcache.getCacheInformation Y Y Y       
blackberry.widgetcache.getCurrentSize Y Y Y       
blackberry.widgetcache.hasCache Y Y Y       

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:

You must declare the feature element(s) below in your configuration document:

Feature IDBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
<feature id="blackberry.widgetcache" /> Y Y Y       

Permission Elements (PlayBook and BlackBerry 10+)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.

Functions

static void blackberry.widgetcache.clearAll ()


Removes all items currently in the cache.


Supported Platforms
 - BlackBerry OS 5.0+


Code Example:
<script type="text/javascript">
  // Clears the cache if its size is over 9000.
  function cleanUp() {
    if(blackberry.widgetcache.getCurrentSize()>9000) {
      blackberry.widgetcache.clearAll();
    }
  }
</script>

static void blackberry.widgetcache.clearCache (url : String)


Clears the cached copy of the specified URL.


Supported Platforms
 - BlackBerry OS 5.0+


Parameters
url The URL for which the cache will be cleared.

static blackberry.widgetcache.CacheInformation[] blackberry.widgetcache.getCacheInformation ()


Requests all the cache information of the cached copies.


Supported Platforms
 - BlackBerry OS 5.0+


Return:

Returns an array of CacheInformation objects


static Number blackberry.widgetcache.getCurrentSize ()


Requests the current total size used by the all the caches.


Supported Platforms
 - BlackBerry OS 5.0+


Return:

Returns the current total size in bytes


static Boolean blackberry.widgetcache.hasCache (url : String)


Checks whether there is a cached copy for the specified URL, whether expired or not.


Supported Platforms
 - BlackBerry OS 5.0+


Parameters
url The URL for which the cache will be checked.

Return:

Returns true if there is a cached copy


Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 18:17:53 GMT-0500 (EST)