News for hackers. Stuff that matters.
Re:Ask HN: Cache Invalidation API in browsers? by tomgallard on Wednesday March 07, 2012 @06:37AM (#3675100)
An immediate thought on this- would be proxies. So it is no good relying on clearing the cache in the local browser, if it is being served a cached version from an upstream proxy server.

It is clearly a problem that needs addressing though. In our web app we have added build steps that seek out all css/js/image links and append version numbers as a query string to defeat the cache.

This works quite well, but has the disadvantage of always clearing the cache for each new release, when in reality not all items need to be cleared.

Re:Ask HN: Cache Invalidation API in browsers? by enomar on Wednesday March 07, 2012 @09:54AM (#3675657)
I don't know how well this works in practice, but it appears HTTP clients can force a check with the origin server if needed:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html

"...request with a "Cache-Control: max-age=0" directive (see section 14.9), to force a check with the origin server."

Re:Ask HN: Cache Invalidation API in browsers? by rdx on Wednesday March 07, 2012 @06:46AM (#3675118)
Yes, I also mentioned proxies like varnish and squid, but problem is they still require a HTTP request. It would be nice if there was an API which enables us to use pure client-side cache invalidation without any extra calls.
Re:Ask HN: Cache Invalidation API in browsers? by tomgallard on Wednesday March 07, 2012 @06:50AM (#3675127)
My point is- that there may be a proxy server outside your control which is caching the content (e.g. inside a corporate network).

Unless you can invalidate the cache here as well, then clearing it in the browser is no good (I suppose you could set your cache headers to disable caching on intermediate proxy servers)

Re:Ask HN: Cache Invalidation API in browsers? by rdx on Wednesday March 07, 2012 @10:31AM (#3675777)
Ahh, yes, I misunderstood that. That would be tricky to circumvent.