Skip to content

Deleting object from cache

This method deleted an object from cache if it is present there. All methods are available via Backendless.Cache.[methodname] accessor:

// synchronous method
public void Delete( String key )

// asynchronous methods
public void Delete( String key, AsyncCallback<Object> callback )

where:

Argument                Description
key identifies the object to delete from cache.
callback the callback used for asynchronous calls to deliver result or fault to the calling program.

Example

AsyncCallback<Object> callback = new AsyncCallback<Object>(
result =>
{
  System.Console.WriteLine( "[ASYNC] object has been deleted from cache" );
},
fault =>
{
  System.Console.WriteLine( "Error - " + fault );
} );

// delete object asynchronously
Backendless.Cache.Delete( "firstorder", callback );

// delete object synchronously
Backendless.Cache.Delete( "firstorder" );

Codeless Reference

caching_codeless_delete_data_from_cache_1

where:

Argument                Description
key name The name is used to identify the key that must be deleted from cache.

This operation does not return a value.

Consider the following key-value pairs stored in cache:

caching_codeless_delete_data_from_cache_2

The example deletes the object associated with the key "orderName" from the cache.

caching_codeless_delete_data_from_cache_3

The result of this operation will look as shown below after the Codeless logic runs, as you can see the object has been successfully deleted from cache:

caching_codeless_delete_data_from_cache_4