I need to to refresh the cache after i add new data to database.
angular.module('app').factory('myService', function ($http,$cacheFactory) {
var profileCache=$cacheFactory('profiles');
//get list of items
function getItem(){
var request=$http({
method:'get',
url:domain+'/api/v1/items/list',
cache:profileCache,
params:{
action:'get'
}
});
return(request.then(response.data));
}
// Post items
function addItem(item){
var request=$http({
method:'post',
url:domain+'/api/v1/items/add',
data:item
});
return(request.then(response.data));
}
})
I want to refresh the cache once the item is added,so that the cache can have new changed data.