Ticket #2551 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

WMS option for Cache-control max-age

Reported by: pramsey Owned by: tomkralidis
Priority: normal Milestone: 5.2 release
Component: WMS Server Version: svn-trunk (development)
Severity: normal Keywords:
Cc:

Description

The attached patch allows users to set the Cache-control: max-age value returned which each map image to a value in seconds, using "http_max_age" "nnn" in the WEB METADATA object. This should provide some speed advantages for tiled clients like openlayers that always access the same WMS GetMap? URLs.

See  http://www.mnot.net/cache_docs/ for a good primer.

Attachments

mapwms-http.patch Download (0.7 KB) - added by pramsey 5 years ago.

Change History

Changed 5 years ago by pramsey

Changed 5 years ago by tomkralidis

Paul: thanks for this.

Before I commit, I want to clarify usage and documentation.

Is this a WMS Server only metadata directive (assuming yes). If yes, then I would like to change:

  if( (http_max_age = msLookupHashTable(&(map->web.metadata), "http_max_age")) )

to:

  if( (http_max_age = msOWSLookupMetadata(&(map->web.metadata), "MO", "http_max_age")) )

Or, if you see this as something which could, over time, be used in more than WMS Server, maybe we should define this as a pure mapfile MAP/WEB/METADATA object, and use:

  if( (http_max_age = msLookupHashTable(&(map->web.metadata), "http_max_age")) )

..as you originally posted in your patch.

Comments?

Changed 5 years ago by tomkralidis

  • milestone changed from FUTURE to 5.2 release

Changed 5 years ago by pramsey

As it stands now, Mapserver is only exercised in a cacheable way via the WMS interface, hence the single insertion in mapwms.c. However, if in the future people begin using the standard CGI interface for pulling tiles, this parameter would also be usable by mapserv.c. Flip a coin, I really don't know the answer. I guess YAGNI says that we should do what makes sense for the present use, and that's to treat it like a WMS parameter.

Changed 5 years ago by tomkralidis

Done:

Note that the metadata directive is called "wms_http_max_age" or "ows_http_max_age" (code searches in that order).

Paul: please double check and close this ticket if all looks good.

Changed 5 years ago by tomkralidis

Paul: have you had a chance to verify this?

Changed 5 years ago by pramsey

  • status changed from new to closed
  • resolution set to fixed

Verified, wms_http_max_age works and returns the right headers.

Note: See TracTickets for help on using tickets.