gapple / drupalreleasedate

System for tracking the Drupal core issue queue
http://drupalreleasedate.com
MIT License
16 stars 6 forks source link

Dynamic HTTP Cache expiry on data responses #16

Closed gapple closed 10 years ago

gapple commented 10 years ago

Right now caching is set to static values, even though we generally know the exact time that data will change. This results in caches being less effective and precise than possible.
For example:

Given that we know the interval between sample fetches and estimate generations, we can set the max-age to the interval between the current time and the time new data is expected to be available (or slightly less).
For example:

If a new sample isn't available when expected the max-age can be set to a moderate value until the new data is available. This is more feasible for samples (where the new values will be available in a matter of minutes) and not so well for estimates (which can take hours).

Estimates throw a bit of a kink in this method though, since a placeholder value is stored based on the last sample it was generated from, and the actual estimate may not be available for a few hours afterwards (and there's no indication of the difference between an incomplete estimate and a script timeout). Samples also have a very short window where the estimates row is stored but not all the related estimate_values rows, but this should be solvable by utilizing a transaction.

gapple commented 10 years ago

The issue with there being no way to tell the difference between an incomplete and a failed estimate was resolved with

gapple commented 10 years ago

Caching headers are improved in 7777ab0bbdf32d1234f7635724b26e3f73ab4876

New configuration values are required in order to calculate the cache periods.

Responses that we know will not change are set to be cached for a year.