[Openstreetmap-dev] Re: [Openstreetmap] cache of editor applet background?

Erik Johansson erjohan at gmail.com
Wed Jan 25 08:35:49 GMT 2006

On 1/24/06, Erik Johansson <erjohan at gmail.com> wrote:
> On 1/24/06, Mikel Maron <mikel_maron at yahoo.com> wrote:
> > This would be another way to do it. But it would add unneeded complexity on the client? And overhead with
> > ETAG generation and requests.
> Short answer no.

So I've tested, and ETags does not work for me, works great for
browser clients but not for squid (YMMV). But If-Not-Modified-Since
header works wonders, and compare that value to the one you  have.

To get it to work set Squid to rewrite reloads to a request with a
If-Modified-Since header[1], now depending on how the expire date is
set squid will ask for updates or just serve the image from cache. 
When Squid asks for update it will send a request with an IMS header,
and when it receives a response " HTTP/1.1 304 Not Modified" it will
send a cached copy back to the client.

Downside is; a cache hit in squid takes 60ms and a IMS-hit to apache
takes upto 800ms.

Sending this back to the client, the only important thing is that the
datestamp needs to change when the data changes.

Cache-Control: cache
Pragma: cache
Expires: $date
Last-Modified: $datestamp

[1] I don't know how the "Min Precantage Max" in refresh pattern
works, I used the more bruteforce "reload_into_ims on" but something
like this should work:

refresh_pattern tile.openstreetmap.org		60	20%	10080 reload-into-ims


More information about the dev mailing list