You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ETags are used in to determine whether pages need to be re-calculated or can be served from cache.
15
15
An ETag generated by `plone.app.caching` is a string of tokens separated by pipe characters that hold values like a user ID, the current skin name, or a counter indicating how many objects have been added to the site.
16
-
This technique is used to quickly calculate the current ETag for the requested resource.
17
-
The browser sends a request with the ETag included in an `If-None-Match` header, and if the ETag is the same, Plone responds with a 304 NOT MODIFIED message, indicating that the browser should use its cached copy.
18
-
If the ETag is different, Plone renders the page and returns it as normal.
16
+
This technique is used to quickly calculate the current ETag for the requested resource.
17
+
The browser sends a request with the ETag included in an `If-None-Match` header.
18
+
If the ETag is the same, then Plone responds with a `304 NOT MODIFIED` message, indicating that the browser should use its cached copy.
19
+
If the ETag is different, then Plone renders the page and returns it as usual.
19
20
20
21
Many caching operations use ETags.
21
22
The tokens to include are typically listed in an `etags` tuple in the operation's options.
22
23
23
24
## Default tokens
24
25
25
-
The ETag names tokens supported by default are:
26
+
The ETag token names supported by default are:
26
27
27
28
| etag | description |
28
29
| --- | --- |
29
-
| userid | The current user's id .|
30
+
| userid | The current user's ID.|
30
31
| roles | A list of the current user's roles in the given context. |
31
32
| language | The language(s) accepted by the browser, in the `ACCEPT_LANGUAGE` header. |
32
33
| userLanguage | The current user's preferred language. |
33
34
| lastModified | A timestamp indicating the last-modified date of the given context. |
34
-
| catalogCounter | A counter that is incremented each time the catalog is updated. I.e. each time content in the site is changed. |
35
+
| catalogCounter | A counter that is incremented each time the catalog is updated, such as when content in the site is changed. |
35
36
| locked | Whether or not the given context is locked for editing. |
36
37
| skin | The name of the current skin (theme). |
37
38
| resourceRegistries | A timestamp indicating the last-modified timestamp for the Resource Registries. This is useful for avoiding requests for expired resources from cached pages. |
@@ -40,12 +41,12 @@ The ETag names tokens supported by default are:
40
41
41
42
It is possible to provide additional tokens by registering an `IETagValue` adapter.
42
43
43
-
This should be a named adapter on the published object (typically a view, file resource or Zope page template object) and request, with a unique name.
44
+
This should be a named adapter on the published object (typically a view, file resource, or Zope page template object) and request, with a unique name.
44
45
45
46
The name is used to look up the component.
46
-
Thus, you can also override one of the tokens above for a particular type of context or request (e.g. via a browser layer), by registering a more specific adapter with the same name.
47
+
Thus you can override one of the tokens above for a particular type of context or request, including via a browser layer, by registering a more specific adapter with the same name.
47
48
48
-
As an example, here is the `language` adapter:
49
+
As an example, here is the `language` adapter.
49
50
50
51
```python
51
52
from plone.app.caching.interfaces import IETagValue
0 commit comments