forked from cuspaceflight/tawhiri
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic ETag support for the prediction API. On each request, an ETag is computed by hashing the prediction request with the dataset which would satisfy it. This ETag is then returned via the ETag header to the client. Should a server set the If-None-Match header on the incoming request, it is compared to the computed ETag and, if they match, a 304 response is returned. If ETags match then the prediction is not run and the client is instructed (via the 304 response) to use the cached version. Note that this does not directly help us with the current UI since the $.ajax() function must have ifModified set explicitly to true to enable caching support. In that case $.ajax() synthesises a fail. (Quite why jQuery people can't let the browser sort out its own caching I don't know.) It's expected that ETags would be more useful when the predictor is put behind some sort of caching proxy (e.g. varnish) which understands ETag/If-None-Match.
- Loading branch information
Showing
1 changed file
with
77 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters