Opened 13 years ago

Last modified 13 years ago

#4045 new enhancement

Allow for fixed date/time expires settings in mapcache

Reported by: rdewit Owned by: tbonfort
Priority: normal Milestone:
Component: MapCache Version: unspecified
Severity: normal Keywords:
Cc:

Description

Currently <expires> and <auto_expire> are set in seconds after tile creation.

Sometimes it can be useful to set the expires value to a fixed point in time, for example when creating caches of weather forecasts that renew every hour on the hour.

Note: Ideally it would be possible to use a cron-like syntax for automatically updating the <expires> and <auto_expire> values, but that is out of scope for this ticket.

Change History (4)

comment:1 by tbonfort, 13 years ago

What about an expiry time in seconds after tile creation, but rounded to the nearest/lower/upper time resolution ?

eg: all tiles created from 10:00:00 to 10:59:59 expire at 11:00:00

comment:2 by rdewit, 13 years ago

I like the idea, but would that work if some layers would be updated by the hour, some every day and some 2x per month?

How would you define what the time resolution looks like?

comment:3 by tbonfort, 13 years ago

You're right, the resolution used should be configurable, to be able to specify the recurrence in hours,days,weeks, months,...

2x per month is going to be problematic, as I have found no simple api/library that lets you add half a month to a timestamp.

Adding a simple timestamp to the expires configuration is not very involved, the configuration of <expires> could be changed to something like:

<expires>
  <timestamp>2011/12/16 20:00:00</timestamp>
</expires>

or

<expires> <!-- relative to access time -->
  <access>
     <hours>1</hours>
     <minutes>30</minutes>
  </access>
</expires>

or

<expires> <!-- relative to tile modification time -->
  <mtime>
     <hours>1</hours>
     <minutes>30</minutes>
  </mtime>
</expires>

the actual <expires>number</expires> would be mapped to

<expires>
  <access>
     <seconds>number</seconds>
  </access>
</expires>

Recurring expiration would be more involved, and would need discussion as to what features to provide, and what syntax would be used for configuration.

comment:4 by rdewit, 13 years ago

For my use case, the timestamp option for both <expires> and maybe also <auto_expire> would be sufficient: the server just needs to inform the browser until when a set of images can be cached locally on the client.

Note: See TracTickets for help on using tickets.