module.exports = function (Vue) {

    Vue.http.interceptors.unshift({

            request: function (request) {

                if (request.cache !== undefined && /^(GET|JSONP)$/i.test(request.method)) {

                    var hit = Vue.cache.get(request.url);

                    if (hit) {
                        delete request.cache;
                        request.client = function () {
                            return hit;
                        };
                    }
                }

                return request;
            },

            response: function (response) {

                if (response.request.cache !== undefined && response.ok) {
                    Vue.cache.set(response.request.url, response, response.request.cache);
                }

                return response;
            }

        }
    );

};

@@ -62,19 +62,93 @@
 unshift(
+function () 
 %7B%0A%0A
+            var hit, key, lifetime;%0A%0A            return %7B%0A    
         
@@ -178,24 +178,28 @@
 request) %7B%0A%0A
+    
             
@@ -303,47 +303,180 @@
     
-var hit = Vue.cache.get(request.url);%0A%0A
+    if (_.isObject(request.cache)) %7B%0A                            lifetime = request.cache.lifetime;%0A                            key = '_resource.' + request.cache.key;%0A    
     
@@ -495,16 +495,14 @@
     
-if (hit)
+%7D else
  %7B%0A 
@@ -528,14 +528,22 @@
     
-delete
+    lifetime =
  req
@@ -554,16 +554,179 @@
 .cache;%0A
+                            key = request.url;%0A                        %7D%0A%0A                        hit = Vue.cache.get(key);%0A                        if (hit) %7B%0A    
         
@@ -796,24 +796,28 @@
             
+   
+ 
 return hit;%0A
@@ -840,19 +840,27 @@
         
-%7D;%0A
+    %7D;%0A    
         
@@ -881,35 +881,43 @@
                 
-%7D%0A%0A
+    %7D%0A%0A    
                 
@@ -948,12 +948,20 @@
     
+ 
+   
 %7D,%0A%0A
+    
     
@@ -1021,48 +1021,20 @@
     
-if (response.request.cache !== undefined
+    if (!hit
  && 
@@ -1064,24 +1064,28 @@
             
+    
 Vue.cache.se
@@ -1090,65 +1090,38 @@
 set(
-response.request.url, response, response.request.cache);%0A
+key, response, lifetime);%0A    
     
@@ -1143,32 +1143,36 @@
                 
+    
 return response;
@@ -1176,33 +1176,52 @@
 se;%0A            
+  
-%7D
+  %7D%0A            %7D;
 %0A%0A        %7D%0A    

update cache interceptor