[OSM-dev] Tile caching
Erik Johansson
erjohan at gmail.com
Wed Sep 20 12:33:45 BST 2006
On 9/20/06, Dean Earley <dean at earlsoft.co.uk> wrote:
> Hi all.
>
> Chris Schmidt mentioned an interesting idea in #geo for use in OL.
> His idea was to implement/support the Last-Modified and If-Modified-Since
> HTTP headers for tile generation/serving.
>
> Steve says that the API can't currently get the "last update" in a
> bounding box but its easy with direct DB access (0.4? :).
> If we were to implement caching based on this time, it would allow for
> near instant updates and almost indefinate caching for unchanged tiles.
> Of course, we couldn't just rely on the browser cahcing and would nbeed to
> cache internally based on the same "last modified" time.
>
> This wouldn't effect the time taken to render a tile int he first place
> though.
>
This is why we had that long thread about using quadtiles, to store
what has been changed. Because it's only easy to fetch what nodes have
been changed, something like this in dao.rb?
# Returns true if the nodes in bbox has been modified after the date,
def if-modified-since(lat1,lon,lat2,lon2,date)
if date &&
res = call_sql("select id from current_nodes where latitude > #{lat2} and
latitude < #{lat1} and longitude > #{lon1} and longitude < #{lon2} and
date > #{date.strftime('%Y-%m-%d %H:%M:%S')} limit 1,1")
if res.nil?
return false
end
return true
end
But this doesn't catch ways/segment/tag changes.
More information about the dev
mailing list