rest - How can a HTTP client request the server for latest data/to refresh cache? -


we're designing rest service server-side caching. we'd provide option client ask latest data if cached data has not expired. i'm looking http 1.1 spec see if there exists standard way this, , cache revalidation , reload controls appears fit need.

questions:

  • should use cache revalidation , reload controls?
  • if not, acceptable include if-modified-since header epoch time, causing server consider resource have changed? spec doesn't preclude this, i'm wondering if i'm abusing :) intent of header?
  • what'd way identify resource refresh? in our case, url path alone not enough, , i'm not sure if query or matrix parameters considered part of unique url. using etag?

if client wants fresh representation of resource, may specify max-age=0 that. intent receive response no older 0 seconds.

all other mechanisms mentioned (if-modified-since, etag, if-match, etc.) working caches make sure resource in state. work only, if know have valid state of resource. can think of optimistic locking. can make conditional requests when resource did, or did not change. have know whether expecting change or not.

you potentially misuse if-modified-since say, max-age communicates intent better.

also note, design there may multiple caches along way, not server side cache. client caches also, , there may other transparent caches on way.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -