hi as i read from the Angular documentation this is how to set the cache on $http request:
cache – {boolean|Cache} – If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
I mean setting {cache:true}
how much time the request will be cached for??
Is possible to set the cache max time?
This cache keeps the loaded data as long as the full html site did not change. E.g. if you have a regular SPA the data are kept in cache for the full app lifetime. There is no build in way to set a maximum cache time. If you would like to clear the cache you have to do it by your self.
var cache = $cacheFactory.get('$http');
cache.removeAll();
More information regarding the $cacheFactory: http://docs.angularjs.org/api/ng.$cacheFactory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With