On Mon, Mar 5, 2012 at 12:30 PM, Patrick McManus <mcmanus@duck...> wrote:
> On Mon, 2012-03-05 at 12:17 -0800, Taras Glek wrote:
>> * query if an item is in cache
> I was at a meeting of devops folks last week and I was asked for that
> one a lot. An awful lot :)
> Additionally - ability to asynchronously fetch and place items in the
> cache for future use if they weren't currently fresh. (it wasn't clear
> to me exactly why manipulating the dom for link prefetch didn't do that
> - though I was assured it didn't.)
> it seems to me that grouping and prioritizing are probably
> implementation details that would be better off not tieing our hands by
> exposing. If we did a decent job with them it would be a non issue.
> maybe I'm wrong.
We should definitely be able to come up with an API which provides
some cache control for pages. My first question is, what are the use
cases? I.e. what is it that people want to do?
Is it as simple as facebook knowing that you'll likely need resource
at url X in a few seconds, and so want to make us start fetching it
Or do they need to pin an resource in the cache because the user
experience would be really bad if they had to hit the network (I.e.
the resource is an image that is part of an animation or a mouse-over
effect, or is used in a game).
I'd like to hear more about why people want to query if an item exists
in the cache. Would it be ok that even if they get a "yes" answer, by
the time they use the resource it might have gotten evicted. Last time
I checked, people didn't quite realize this. We could of course
provide a way to hand back a cache token which would keep the item
pinned as long as it was kept alive.
The article Taras is linking to is actually asking for something very
simple: Being able to update the expiration of a already-cached
resource. But looking at the comments it doesn't seem like everyone
thinks it's a good idea. And further down in the comments he
acknowledge that he might not understand the HTTP cache as well as he
gives the impression to do.
In general, one problem that I feel that we often run into is that
people simply don't understand the features that we already have for
cache control. In particular people seem to have a terrible time
setting their cache headers correctly. This is of course not meant to
blow off the problem. If the features are too complex to use then we
need better features.