Question: 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.

Answer: 
as you can read here

<https://docs.angularjs.org/api/ng/service/$http>

**$http responses are not cached by default**

but if you have particular environment and you need to prevent any caching you can add a date time to your request
example

```
function getItem(){
   var d = new Date();
   var n = d.getDate();
   var request=$http({
     method:'get',
     url:domain+'/api/v1/items/list?' + n,
     cache:true,
     params:{
       action:'get'
     }
   });
   return(request.then(response.data));
 }

```
var $httpDefaultCache = $cacheFactory.get('$http');