167
edits
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 12: | Line 12: | ||
If it is easy to generate a unique identifier that always changes when the response changes you can use that as an ETag identifier. This is done using the [[ETag Header]]: | If it is easy to generate a unique identifier that always changes when the response changes you can use that as an ETag identifier. This is done using the [[ETag Header]]: | ||
ETag: W/"my-unique-identifier" | |||
Cache-Control: public,maxage=5,must-revalidate | |||
This example will ask the cache to keep serving this response to requests coming in in the next 5 seconds. If a matching request comes in after the five seconds the cache will check whether it still has the last version using the [[If-None-Match header]]. | This example will ask the cache to keep serving this response to requests coming in in the next 5 seconds. If a matching request comes in after the five seconds the cache will check whether it still has the last version using the [[If-None-Match header]]. | ||
| Line 33: | Line 33: | ||
* Don't put data that changes independently into the same request. Instead use a resource that returns [[URL | URLs]] to the child requests and leverage HTTP2 and caching. | * Don't put data that changes independently into the same request. Instead use a resource that returns [[URL | URLs]] to the child requests and leverage HTTP2 and caching. | ||
* Instead of disabling caching, set the <code>maxage</code> to a low value like 5 seconds. | * Instead of disabling caching, set the <code>maxage</code> to a low value like 5 seconds. | ||
[[Category: Terminology]] | |||