Szymon Kulec
HTTP/1.1 200 OK
Date: Fri, 30 Oct 1998 14:19:41 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, no-cache, public
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Last-Modified: Mon, 29 Jun 1998 02:10:12 GMT
ETag: "3e85-410-3596fbbc"
Content-Length: 1000
Content-Type: text/html
header | meaning |
---|---|
max-age=[seconds] | maximum time when cache is considered fresh |
public | response is cacheable |
private | response is cacheable but only for the end client |
no-cache | must revalidate every time |
no-store | don't store it! |
headers | meaning |
---|---|
max-age=3600, private | keep up to 1h but only on the client (no proxy) |
max-age=3600, no-cache, public | keep up to 1h but validate every time the resource is needed |
header | sender | meaning |
---|---|---|
Last-Modified | server | date of last mofification |
If-Modified-Since | client | date from the cached version |
ETag | server | logical version of the resource |
If-None-Match | client | logical version from the cached version |
# | sender | data |
---|---|---|
1 | client | GET |
2 | server | body + ETag: 12312 |
3 | client | GET + If-None-Match: 12312 |
4 | server | 304: Not Modified |
HTTP/1.1 200 OK
Date: Fri, 30 Oct 1998 14:19:41 GMT
Server: Apache/1.3.3 (Unix)
Cache-Control: max-age=3600, no-cache, public
Expires: Fri, 30 Oct 1998 14:19:41 GMT
Last-Modified: Mon, 29 Jun 1998 02:10:12 GMT
ETag: "3e85-410-3596fbbc"
Content-Length: 1000
Content-Type: text/html
GET http://127.0.0.1:2113/streams/mystream
Cache-Control: max-age=0, no-cache, must-revalidate
ETag: "1;248368668"
{
"entries": [
{
"title": "1@mystream",
"id": "http://127.0.0.1:2113/streams/mystream/1"
},
{
"title": "0@mystream",
"id": "http://127.0.0.1:2113/streams/mystream/0"
}
]
}
// one can easily obtain etag of the given document
var eTag = (Guid)session.Advanced.GetEtagFor(objectToSave);
// optimistic concurrency with retrieved tag value
session.Store(objectToSave, eTag);
<html>
...
<body>
<script type="text/javascript">
Object.prototype.__defineSetter__('Id', function(obj){alert(obj);});
</script>
<script src="http://yourbank.com/using/get/forJSON"></script>
</body>
</html>
If you're into web apps & services development, you should know about http cache and probably use it.
There are only two hard things in Computer Science: cache invalidation and naming things.
Phil Karlton
There is only one hard things in Computer Science: naming things.
me
Szymon Kulec @Scooletz http://blog.scooletz.com