WidgetCache

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

Supported Platform(s)

- BlackBerry OS 5.0+

View Supported Platform Table

APIOS 5.0OS 6.0OS 7.0PlayBookRipple
clearAll Y Y Y   
clearCache Y Y Y   
getCacheInformation Y Y Y   
getCurrentSize Y Y Y   
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 IDOS 5.0OS 6.0OS 7.0PlayBookRipple
<feature id="blackberry.widgetcache" /> Y Y Y   

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

clearAll


static void clearAll()

Supported Platform(s)

 - BlackBerry OS 5.0+

Description

Removes all items currently in the cache.



Code Example(s)

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

clearCache


static void clearCache(url : String)

Supported Platform(s)

 - BlackBerry OS 5.0+

Description

Clears the cached copy of the specified URL.



Parameter Type Description
url String The URL for which the cache will be cleared.

getCacheInformation


static blackberry.widgetcache.CacheInformation[] getCacheInformation()

Supported Platform(s)

 - BlackBerry OS 5.0+

Description

Requests all the cache information of the cached copies.



Returns

Returns an array of CacheInformation objects

getCurrentSize


static Number getCurrentSize()

Supported Platform(s)

 - BlackBerry OS 5.0+

Description

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



Returns

Returns the current total size in bytes

hasCache


static Boolean hasCache(url : String)

Supported Platform(s)

 - BlackBerry OS 5.0+

Description

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



Returns

Returns true if there is a cached copy

Parameter Type Description
url String The URL for which the cache will be checked.

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Dec 30 2012 13:31:21 GMT-0500 (EST)