UGC Clear Cache Method

Follow

The ClearCache method allows you to clear a set of search results from the cache based on a specified key. Use this method if you want to clear cache but you are not saving a record.

ClearCache in Javascript

//if the data should be cached based on a custom key...
searchAry.CacheKey = "MyCustomCacheKey"; //TODO: calculate this key value, and only use if necessary.
 
//invoke the ClearCache method, which is asynchronous, and has a callback
Agility.UGC.API.ClearCache(searchArg, function(data) {  
     
    if (data.ResponseType != Agility.UGC.API.ResponseType.OK) {
        //error occurred
        alert("An error occurred: " + data.Message);            
    } else {
        //the cache was cleared successfully...
    }
}

 

ClearCache in .NET

using (Agility_UGC_API_WCFClient client = DataServiceUtil.GetUGCClient())
{
     DataServiceAuthorization auth =
     DataServiceUtil.GetDataServiceAuthorization(-1);
     string cacheKey = "MyCustomCacheKey"; //TODO: generate this key based on realistic parameters.
     client.ClearCache(auth, cacheKey);
}
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.