My AngularJS application requires caching of REST service responses, and I've come across libraries like angular-cached-resource that store data in the local browser storage.
However, there are times when certain cached responses need to be deleted due to POST / PUT / DELETE REST calls. In such cases, it's necessary to clear the cache so that the call is sent to the server again.
If the server sends values like 'expires' or 'etag' in the HTTP Header, do I have to manually read the header and react accordingly? Or does AngularJS offer a library that can handle this automatically?
Determining whether to hit the server instead of reading from the cache depends on the HTTP Header Cache fields and certain calls requiring a response indicating the need for a reload (e.g., "reload of every user settings element"). This mandates creating a map that specifies which REST services should contact the server next time they are executed or if the Cache expires based on the HTTP Headers.
Are there any AngularJS libraries that facilitate this process, or do you have alternative recommendations? Does this scenario remind you of the Observer or PubSub pattern?
Additionally, Is there a way to implement PubSub functionality without utilizing cache/local storage (and hence no HTTP Header Cache controls)? I want to avoid hitting the server unless absolutely necessary (e.g., upon receiving an event like "reload of every user settings element" from a previous REST call).