Question: To add caching inside http is pretty straight forward. ( by passing cache=true )

[http://docs.angularjs.org/api/ng.$http](https://docs.angularjs.org/api/ng/service/$http) has Cache option.

How do I add similar functionality in $resource in angularjs ?

Answer: 
Implementing your own cache in AngularJs is quite easy. Just use [$cacheFactory](http://docs.angularjs.org/api/ng.%24cacheFactory):

```
app.factory('myService', function($resource, $cacheFactory) {
   var cache = $cacheFactory('myService');
   var User = $resource('/user/:userId', {userId:'@id'});

   return {
      getResource: function(userId) {
         var user = cache.get(userId);
         if (!user) {
            user = User.get({userId:userId});
            cache.put(userId, user);   
         }
         return user;
      }
   };
});

```
You can also set default cache for $http and thus for $resource which is based on it.

My settings with the excellent [angular-cache](https://github.com/jmdobry/angular-cache) allowing LocalStorage and compliant with $cacheFactory:

```
app.run(function($http, DSCacheFactory) {

    DSCacheFactory('defaultCache', {
        deleteOnExpire: 'aggressive',
        storageMode: 'localStorage' 
    });

    $http.defaults.cache = DSCacheFactory.get('defaultCache');
});

```