|
1 | 1 | --- |
2 | 2 | myst: |
3 | 3 | html_meta: |
4 | | - "description": "Caching support for Rest API" |
5 | | - "property=og:description": "Caching support for Rest API" |
6 | | - "property=og:title": "Caching support for Rest API" |
| 4 | + "description": "Caching support for Plone REST API" |
| 5 | + "property=og:description": "Caching support for Plone REST API" |
| 6 | + "property=og:title": "Caching support for Plone REST API" |
7 | 7 | "keywords": "Plone, deployment, automation, caching" |
8 | 8 | --- |
9 | 9 |
|
10 | 10 | (caching-restapi-label)= |
11 | 11 |
|
12 | | -# Rest API support |
| 12 | +# REST API support |
| 13 | + |
| 14 | +This chapter describes techniques to implement caching with the Plone REST API. |
13 | 15 |
|
14 | 16 | ## Strategy |
15 | 17 |
|
16 | | -Caching for anonymous users for all GET requests. |
| 18 | +This section desribes how to cache all GET requests from anonymous users. |
17 | 19 |
|
18 | | -Remark: Some POST requests, like `@querystring`, should be turned into GET in order to better cache. |
| 20 | +```{note} |
| 21 | +Some POST requests, such as `@querystring`, should be turned into GET to improve cache. |
| 22 | +``` |
19 | 23 |
|
20 | 24 | We have endpoints following classic `plone.content.itemView` content and do not accept parameters. |
21 | 25 | Those can be handled with the default rules, including purge. |
22 | 26 |
|
23 | | -There are others delivering dynamic content, like search, impossible to purge. |
24 | | -Those shall be cached using a shorttime cache (like some seconds to some minutes). |
25 | | - |
26 | | -This get covered by the rulesetType `plone.content.dynamic`. |
27 | | -It is configured to cache by default in browser 10sec, in caching-proxy 60 seconds. |
28 | | -Its goal is primary to reduce the load/peak-load on the server. |
29 | | -Also, it reduces the impact of loading the same endpoint more than one time in one page. |
| 27 | +There are others delivering dynamic content, such as search, which are impossible to purge. |
| 28 | +Those will be cached using a transient cache, lasting a few seconds or minutes. |
30 | 29 |
|
| 30 | +This gets covered by the `rulesetType` `plone.content.dynamic`. |
| 31 | +By default it is configured to cache in the browser for 10 seconds, and in the caching proxy server for 60 seconds. |
| 32 | +Its primary goal is to reduce the load and peak-load on the server. |
| 33 | +Also it reduces the impact of loading the same endpoint more than one time in one page. |
31 | 34 |
|
32 | | -## plone.restapi GET endpoints |
33 | 35 |
|
34 | | -And its environment and assignments: |
| 36 | +## `plone.restapi` GET endpoints |
35 | 37 |
|
36 | | -- `@actions` |
| 38 | +Environment and assignments: |
37 | 39 |
|
38 | | - - Anonymous |
39 | | - - rule plone.content.dynamic (might be influenced by other content) |
40 | | - - purge |
| 40 | +- `@actions` |
| 41 | +j |
| 42 | + - Anonymous |
| 43 | + - rule `plone.content.dynamic` (might be influenced by other content) |
| 44 | + - purge |
41 | 45 |
|
42 | | -- `@addons` |
| 46 | +- `@addons` |
43 | 47 |
|
44 | | - - Authenticated |
45 | | - - no rule assignment |
| 48 | + - Authenticated |
| 49 | + - no rule assignment |
46 | 50 |
|
47 | | -- `@breadcrumbs` |
| 51 | +- `@breadcrumbs` |
48 | 52 |
|
49 | | - - Anonymous |
50 | | - - rule plone.content.dynamic (parent may change) |
51 | | - - purge |
| 53 | + - Anonymous |
| 54 | + - rule `plone.content.dynamic` (parent may change) |
| 55 | + - purge |
52 | 56 |
|
53 | | -- `@comments` |
| 57 | +- `@comments` |
54 | 58 |
|
55 | | - - Anonymous |
56 | | - - rule plone.content.itemView |
57 | | - - purge |
| 59 | + - Anonymous |
| 60 | + - rule `plone.content.itemView` |
| 61 | + - purge |
58 | 62 |
|
59 | | -- `/` (content) |
| 63 | +- `/` (content) |
60 | 64 |
|
61 | | - - Anonymous |
62 | | - - expander! |
63 | | - - rule plone.content.dynamic |
| 65 | + - Anonymous |
| 66 | + - expander! |
| 67 | + - rule `plone.content.dynamic` |
64 | 68 |
|
65 | | -- `@history` |
| 69 | +- `@history` |
66 | 70 |
|
67 | | - - Authenticated |
68 | | - - no rule assignment |
| 71 | + - Authenticated |
| 72 | + - no rule assignment |
69 | 73 |
|
70 | | -- `@lock` |
| 74 | +- `@lock` |
71 | 75 |
|
72 | | - - Authenticated |
73 | | - - no rule assignment |
| 76 | + - Authenticated |
| 77 | + - no rule assignment |
74 | 78 |
|
75 | | -- `@translations` |
| 79 | +- `@translations` |
76 | 80 |
|
77 | | - - Anonymous |
78 | | - - with parameters |
79 | | - - rule plone.content.dynamic |
| 81 | + - Anonymous |
| 82 | + - with parameters |
| 83 | + - rule `plone.content.dynamic` |
80 | 84 |
|
81 | | -- `@translations-locator` |
| 85 | +- `@translations-locator` |
82 | 86 |
|
83 | | - - Authenticated |
84 | | - - no rule assignment |
| 87 | + - Authenticated |
| 88 | + - no rule assignment |
85 | 89 |
|
86 | | -- `@navigation` |
| 90 | +- `@navigation` |
87 | 91 |
|
88 | | - - Anonymous |
89 | | - - with parameters |
90 | | - - rule plone.content.dynamic |
| 92 | + - Anonymous |
| 93 | + - with parameters |
| 94 | + - rule `plone.content.dynamic` |
91 | 95 |
|
92 | | -- `@querysources` |
| 96 | +- `@querysources` |
93 | 97 |
|
94 | | - - Authenticated |
95 | | - - with parameters |
96 | | - - can not be cached |
| 98 | + - Authenticated |
| 99 | + - with parameters |
| 100 | + - can not be cached |
97 | 101 |
|
98 | | -- `@querystring` |
| 102 | +- `@querystring` |
99 | 103 |
|
100 | | - - Anonymous |
101 | | - - (values on IPloneSiteRoot from registry) |
102 | | - - rule plone.content.dynamic |
| 104 | + - Anonymous |
| 105 | + - (values on `IPloneSiteRoot` from registry) |
| 106 | + - rule `plone.content.dynamic` |
103 | 107 |
|
104 | | -- `@querystring-search` |
| 108 | +- `@querystring-search` |
105 | 109 |
|
106 | | - - is in `get.py` BUT configured as POST |
107 | | - - Anonymous |
108 | | - - with json body |
109 | | - - can not be cached |
| 110 | + - is in `get.py` but configured as POST |
| 111 | + - Anonymous |
| 112 | + - with JSON body |
| 113 | + - can not be cached |
110 | 114 |
|
111 | | -- `@registry` |
| 115 | +- `@registry` |
112 | 116 |
|
113 | | - - Authenticated |
114 | | - - with subpath |
115 | | - - no rule assignment |
| 117 | + - Authenticated |
| 118 | + - with subpath |
| 119 | + - no rule assignment |
116 | 120 |
|
117 | | -- `@roles` |
| 121 | +- `@roles` |
118 | 122 |
|
119 | | - - Authenticated |
120 | | - - no rule assignment |
| 123 | + - Authenticated |
| 124 | + - no rule assignment |
121 | 125 |
|
122 | | -- `@search` |
| 126 | +- `@search` |
123 | 127 |
|
124 | | - - Anonymous |
125 | | - - with parameters |
126 | | - - rule plone.content.dynamic |
| 128 | + - Anonymous |
| 129 | + - with parameters |
| 130 | + - rule `plone.content.dynamic` |
127 | 131 |
|
128 | | -- `@sources` |
| 132 | +- `@sources` |
129 | 133 |
|
130 | | - - Authenticated |
131 | | - - no rule assignment |
| 134 | + - Authenticated |
| 135 | + - no rule assignment |
132 | 136 |
|
133 | | -- `@tiles` |
| 137 | +- `@tiles` |
134 | 138 |
|
135 | | - - pre-deprecation |
136 | | - - Anonymous |
137 | | - - with subpath |
138 | | - - no rule assignment |
| 139 | + - pre-deprecation |
| 140 | + - Anonymous |
| 141 | + - with subpath |
| 142 | + - no rule assignment |
139 | 143 |
|
140 | | -- `@types` |
| 144 | +- `@types` |
141 | 145 |
|
142 | | - - Authenticated |
143 | | - - no rule assignment |
| 146 | + - Authenticated |
| 147 | + - no rule assignment |
0 commit comments