Opened 13 years ago

Closed 7 years ago

#579 closed enhancement (wontfix)

API should honour conditional If-Modified-Since HTTP GET

Reported by: Grant Slater Owned by: rails-dev@…
Priority: minor Milestone:
Component: api Version:
Keywords: If-Modified-Since Caching Cache Cc:


As cheaply as possible the API should honour conditional If-Modified-Since HTTP GET. (Maybe initially only on: /api/0.5/map?bbox=)

If-Modified-Since header definition:

Rails Code example:

This would allow more intelligence in downstream clients. Eg: TilesAtHome? having the ability to only run a full API map GET request and re-render if the tile/area has actually been modified.

This paves the way for "freshness" validated caching.

Blocked By: Bug #578

Change History (4)

comment:1 Changed 13 years ago by Tom Hughes

Now you're just taking the piss! There is no way on earth that this is likely to get done anytime soon...

comment:2 Changed 13 years ago by Grant Slater

Priority: majorminor

Apologies if I am being loon. Resolve -> wontfix is suitable then.

OK, working out when a ways or relations within a bounding box has changed is difficult (and costly)

How about the following...

Create new db table storing last modified time of layer 12 tiles. Kept updated by using a mysql trigger on db tables; current_nodes, current_way_nodes and current_relation_members.

On a API map request without an If-Modified-Since: the bounding box is normalised to find the layer 12 tiles it applies to, selecting the MAX modified time and using this as the Last-Modified time.

On a API map request with an If-Modified-Since: If-Modified-Since time is compared to bounding box layer 12 tiles' MAX modified time. If MAX modified time <= If-Modified-Since short circuit ELSE proceed with normal request.

Shared proxy-cache in front of web would result in most request being If-Modified-Since conditional request. Rounding bounding boxes requests up to semi standard sizes could result in worthwhile cache hits.

Conditional GET Usage example:

  • T@H client downloads map (layer 12) and renders, storing Last-Modified time returned by API, subsequent T@H client API Map download of that tile would be If-Modified-Since conditional based request using previous stored Last-Modified time.

comment:3 Changed 9 years ago by Tom Hughes

Owner: changed from Tom Hughes to rails-dev@…

comment:4 Changed 7 years ago by iandees

Resolution: wontfix
Status: newclosed

The API will have to work just as hard to check modification dates as it would to return the entire result.

Note: See TracTickets for help on using tickets.