-
Notifications
You must be signed in to change notification settings - Fork 7
HttpCacheHandlerSettings Explained
To change the default settings, pass in an instance of HttpCacheHandlerSettings when you create the HttpCacheHandler instance.
When true, IfMatch and IfUnmodifiedSince headers will be added to PUT requests if the related response was previously cached. Default = true;
When true, IfMatch and IfUnmodifiedSince headers will be added to PATCH requests if the related response was previously cached. Default = true;
After a succesful PUT request, resource representations you have in your cache that were related to this request (eg: same resource, but different represenation) might not be up to date. Setting this to true automatically clears all those from the cache store. Note that this is included convenience - it overrides any header values that might have been returned from the cache-enabled API and effectively clears all resource representations related to the resource that was updated from the client-side cache store. As this behaviour is often desired, default = true.
For example, if you have an API that allows you to select specific fields from a resource, like api/customers/1?fields=id,name, updating that resource with a PUT to api/customers/1 will clear all cached items starting with that key (thus regardless of the query string) - this ensures that next time you get that response, it's coming from the API, not from cache.
After a succesful PATCH request, resource representations you have in your cache that were related to this request (eg: same resource, but different represenation) might not be up to date. Setting this to true automatically clears all those from the cache store. Note that this is included convenience - it overrides any header values that might have been returned from the cache-enabled API and effectively clears all resource representations related to the resource that was updated from the client-side cache store. As this behaviour is often desired, default = true.
When true, stale resources represenations will always be validated, even if must-revalidate is false. When false, regular cache revalidation rules will be taken into account.