addEntry(IODataEntry) method

A new cache entry will be added into the local Cache using this particular method.

Syntax

public String addEntry ( IODataEntry entry ) throws CacheException

Parameters

Exceptions

Example 1


Try{
//Fire a HTTP POST 
IODataEntry entry = buildPostEntry();
ILogger logger = new  Logger();
ICache cache =new Cache(getApplicationContext(),logger);
String generated_id =cache.addEntry(entry);
PerformPostrequest(entry)//Fire HTTP POST request
}
Catch(CacheException e){
}. public void onSuccess(I Request arg0, I Response aResponse) {

 ClearLocalEntry(generated_id)//on success of POST request ,application developer clears this entry after all the Cache instances related to this entry (filter/query all matching) are updated from the server
 }

Usage

This method will be mostly called when the application is trying to create entries in the backend via a HTTP POST.