From 72fa7d92129925c4ae45e482b4573606ab94b8cb Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Mon, 13 Sep 2021 11:50:50 +0200 Subject: [PATCH 1/3] Split default/registry.xml into various files. The general settings remain in registry.xml. Weak, moderate, strong, terse, and generic get their own file in the registry directory. (Generic is not used by default, it was commented out in the original.) This should give a better overview. Also, this makes it easier to copy `registry/terse.xml` for an upgrade step. --- plone/app/caching/operations/configure.zcml | 2 +- .../app/caching/profiles/default/registry.xml | 279 ------------------ .../profiles/default/registry/generic.xml | 57 ++++ .../profiles/default/registry/moderate.xml | 53 ++++ .../profiles/default/registry/strong.xml | 61 ++++ .../profiles/default/registry/terse.xml | 61 ++++ .../profiles/default/registry/weak.xml | 45 +++ 7 files changed, 278 insertions(+), 280 deletions(-) create mode 100644 plone/app/caching/profiles/default/registry/generic.xml create mode 100644 plone/app/caching/profiles/default/registry/moderate.xml create mode 100644 plone/app/caching/profiles/default/registry/strong.xml create mode 100644 plone/app/caching/profiles/default/registry/terse.xml create mode 100644 plone/app/caching/profiles/default/registry/weak.xml diff --git a/plone/app/caching/operations/configure.zcml b/plone/app/caching/operations/configure.zcml index 416c0d4..a142fe3 100644 --- a/plone/app/caching/operations/configure.zcml +++ b/plone/app/caching/operations/configure.zcml @@ -24,7 +24,7 @@ - diff --git a/plone/app/caching/profiles/default/registry.xml b/plone/app/caching/profiles/default/registry.xml index 8488373..6dbbf1c 100644 --- a/plone/app/caching/profiles/default/registry.xml +++ b/plone/app/caching/profiles/default/registry.xml @@ -12,10 +12,6 @@ - @@ -53,279 +49,4 @@ - - - - - ETags - A list of ETag component names to include - - False - - - - - - - Last-modified validation - Turn on Last-Modified headers - False - - False - - - - RAM cache - Turn on caching in Zope memory - False - - False - - - - Vary - Name(s) of HTTP headers that must match for the caching proxy to return a cached response - False - - - - - - Only cache for anonymous users - Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. - False - - False - - - - - - - Maximum age - Time (in seconds) to cache the response in the browser - False - - 10 - - - - Shared maximum age - Time (in seconds) to cache the response in the caching proxy - False - - 60 - - - - ETags - A list of ETag component names to include - - False - - - - - - - Last-modified validation - Turn on Last-Modified headers - False - - False - - - - RAM cache - Turn on caching in Zope memory - False - - False - - - - Vary - Name(s) of HTTP headers that must match for the caching proxy to return a cached response - False - - - - - - Only cache for anonymous users - Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. - False - - False - - - - - - - Shared maximum age - Time (in seconds) to cache the response in the caching proxy - False - - 86400 - - - - ETags - A list of ETag component names to include - - False - - - - - - - Last-modified validation - Turn on Last-Modified headers - False - - False - - - - RAM cache - Turn on caching in Zope memory - False - - False - - - - Vary - Name(s) of HTTP headers that must match for the caching proxy to return a cached response - False - - - - - - Only cache for anonymous users - Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. - False - - False - - - - - - Maximum age - Time (in seconds) to cache the response in the browser or caching proxy - False - - 86400 - - - - Shared maximum age - Time (in seconds) to cache the response in the caching proxy. Leave blank to use value from "Maximum age" field. - False - - - - - - ETags - A list of ETag component names to include - - False - - - - - - - Last-modified validation - Turn on Last-Modified headers - False - - False - - - - RAM cache - Turn on caching in Zope memory - False - - False - - - - Vary - Name(s) of HTTP headers that must match for the caching proxy to return a cached response - False - - - - - - Only cache for anonymous users - Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. - False - - False - - - - - diff --git a/plone/app/caching/profiles/default/registry/generic.xml b/plone/app/caching/profiles/default/registry/generic.xml new file mode 100644 index 0000000..8c5bfd2 --- /dev/null +++ b/plone/app/caching/profiles/default/registry/generic.xml @@ -0,0 +1,57 @@ + + + + diff --git a/plone/app/caching/profiles/default/registry/moderate.xml b/plone/app/caching/profiles/default/registry/moderate.xml new file mode 100644 index 0000000..ed68cb0 --- /dev/null +++ b/plone/app/caching/profiles/default/registry/moderate.xml @@ -0,0 +1,53 @@ + + + + + Shared maximum age + Time (in seconds) to cache the response in the caching proxy + False + + 86400 + + + + ETags + A list of ETag component names to include + + False + + + + + + + Last-modified validation + Turn on Last-Modified headers + False + + False + + + + RAM cache + Turn on caching in Zope memory + False + + False + + + + Vary + Name(s) of HTTP headers that must match for the caching proxy to return a cached response + False + + + + + + Only cache for anonymous users + Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. + False + + False + + diff --git a/plone/app/caching/profiles/default/registry/strong.xml b/plone/app/caching/profiles/default/registry/strong.xml new file mode 100644 index 0000000..c7e4df9 --- /dev/null +++ b/plone/app/caching/profiles/default/registry/strong.xml @@ -0,0 +1,61 @@ + + + + + Maximum age + Time (in seconds) to cache the response in the browser or caching proxy + False + + 86400 + + + + Shared maximum age + Time (in seconds) to cache the response in the caching proxy. Leave blank to use value from "Maximum age" field. + False + + + + + + ETags + A list of ETag component names to include + + False + + + + + + + Last-modified validation + Turn on Last-Modified headers + False + + False + + + + RAM cache + Turn on caching in Zope memory + False + + False + + + + Vary + Name(s) of HTTP headers that must match for the caching proxy to return a cached response + False + + + + + + Only cache for anonymous users + Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. + False + + False + + diff --git a/plone/app/caching/profiles/default/registry/terse.xml b/plone/app/caching/profiles/default/registry/terse.xml new file mode 100644 index 0000000..adae5bb --- /dev/null +++ b/plone/app/caching/profiles/default/registry/terse.xml @@ -0,0 +1,61 @@ + + + + + Maximum age + Time (in seconds) to cache the response in the browser + False + + 10 + + + + Shared maximum age + Time (in seconds) to cache the response in the caching proxy + False + + 60 + + + + ETags + A list of ETag component names to include + + False + + + + + + + Last-modified validation + Turn on Last-Modified headers + False + + False + + + + RAM cache + Turn on caching in Zope memory + False + + False + + + + Vary + Name(s) of HTTP headers that must match for the caching proxy to return a cached response + False + + + + + + Only cache for anonymous users + Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. + False + + False + + diff --git a/plone/app/caching/profiles/default/registry/weak.xml b/plone/app/caching/profiles/default/registry/weak.xml new file mode 100644 index 0000000..674f819 --- /dev/null +++ b/plone/app/caching/profiles/default/registry/weak.xml @@ -0,0 +1,45 @@ + + + + + ETags + A list of ETag component names to include + + False + + + + + + + Last-modified validation + Turn on Last-Modified headers + False + + False + + + + RAM cache + Turn on caching in Zope memory + False + + False + + + + Vary + Name(s) of HTTP headers that must match for the caching proxy to return a cached response + False + + + + + + Only cache for anonymous users + Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. + False + + False + + From dd8e1f7c081df9c5c8dffced89f6e3a533b058ed Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Mon, 13 Sep 2021 12:01:14 +0200 Subject: [PATCH 2/3] Moved GS parts of configure.zcml to genericsetup.zcml. --- plone/app/caching/configure.zcml | 17 +---------------- plone/app/caching/profiles.zcml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 plone/app/caching/profiles.zcml diff --git a/plone/app/caching/configure.zcml b/plone/app/caching/configure.zcml index 561a7af..9f9b1fc 100644 --- a/plone/app/caching/configure.zcml +++ b/plone/app/caching/configure.zcml @@ -1,7 +1,6 @@ @@ -14,21 +13,7 @@ - - - - + + + + + + + From 2e1b7d0ddde85794ed8f10d641959793a1176658 Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Mon, 13 Sep 2021 12:11:36 +0200 Subject: [PATCH 3/3] Add upgrade step to define the new base terse cache setting. Fixes https://github.com/plone/plone.app.caching/issues/82 Note: to let this be automatically applied when running @@plone-upgrade, we should add it to the AddOn list in CMFPlone/MigrationTool.py. I will do that part next, but this can be done separately. --- news/82.bugfix | 2 + plone/app/caching/profiles.zcml | 18 ++++++ .../app/caching/profiles/default/metadata.xml | 2 +- .../caching/profiles/v2/registry/terse.xml | 61 +++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 news/82.bugfix create mode 100644 plone/app/caching/profiles/v2/registry/terse.xml diff --git a/news/82.bugfix b/news/82.bugfix new file mode 100644 index 0000000..cb3db02 --- /dev/null +++ b/news/82.bugfix @@ -0,0 +1,2 @@ +Add upgrade step to define the new base terse cache setting. +[maurits] diff --git a/plone/app/caching/profiles.zcml b/plone/app/caching/profiles.zcml index 8bfff04..960191c 100644 --- a/plone/app/caching/profiles.zcml +++ b/plone/app/caching/profiles.zcml @@ -11,6 +11,14 @@ provides="Products.GenericSetup.interfaces.EXTENSION" /> + + + + + + diff --git a/plone/app/caching/profiles/default/metadata.xml b/plone/app/caching/profiles/default/metadata.xml index dc95597..5f38361 100644 --- a/plone/app/caching/profiles/default/metadata.xml +++ b/plone/app/caching/profiles/default/metadata.xml @@ -1,5 +1,5 @@ - 1 + 2 profile-plone.app.registry:default diff --git a/plone/app/caching/profiles/v2/registry/terse.xml b/plone/app/caching/profiles/v2/registry/terse.xml new file mode 100644 index 0000000..adae5bb --- /dev/null +++ b/plone/app/caching/profiles/v2/registry/terse.xml @@ -0,0 +1,61 @@ + + + + + Maximum age + Time (in seconds) to cache the response in the browser + False + + 10 + + + + Shared maximum age + Time (in seconds) to cache the response in the caching proxy + False + + 60 + + + + ETags + A list of ETag component names to include + + False + + + + + + + Last-modified validation + Turn on Last-Modified headers + False + + False + + + + RAM cache + Turn on caching in Zope memory + False + + False + + + + Vary + Name(s) of HTTP headers that must match for the caching proxy to return a cached response + False + + + + + + Only cache for anonymous users + Ensure logging users always get a fresh page. Note that if you are caching pages in a proxy cache, you'll still need to use a Vary response header to keep anonymous and authenticated content separate. + False + + False + +