WidgetCache
The WidgetCache object provides functions and properties to control application Caching behavior.
Supported Platform(s)
- BlackBerry OS 5.0+
View Supported Platform Table
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 ID | OS 5.0 | OS 6.0 | OS 7.0 | PlayBook | Ripple |
<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
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
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)