Retrieving data from cache¶
This API request retrieves an object from Backendless cache. If object is not present in cache, the method returns null for complex types or default value for primitive values.
Backendless.Cache.get( key )
.then( function( objectFromCache ) {
})
.catch( function( error ) {
});
where:
Argument | Description |
---|---|
key |
identifies the object to retrieve from cache. |
Example¶
// see the previous example to understand how the object got into cache
function Order() {
var name;
}
var successCallback = function( response ) {
var order = response;
console.log( "object has been retrieved from cache. order name - " + order.name );
};
var failureCallback = function( fault ) {
console.log( "error - " + fault.message );
};
Backendless.Cache.get( "firstorder" )
.then( successCallback )
.catch( failureCallback );