I've correctly set Restangular to cache my http requests via:
Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.setDefaultHttpFields({cache: true});
});
I would like, however, to be able to manually certain cached elements at a given point in time, eg when they become obsolete due to the user modifying these objects. Is there a way to do this? I've tried:
$cacheFactory.get('$http').info()
Object {id: "$http", size: 7}
Just make use of the $cacheFactory API as documented here:
For instance, to invalidate a given cache entry:
$cacheFactory.get('$http').remove(myGetUrlToInvalidate);
myGetUrlToInvalidate is a string representation of your GET request URL. You may have to test to find out whether its the relative or absolute URL, check out following stackoverflow discussion for more details:
Also of interest this stackoverflow discussion pointing to an alternate cache implementation:
Restangular resources:
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