.../Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php | 4 ++++ core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php | 4 ++++ core/lib/Drupal/Core/Cache/Context/IpCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php | 4 ++++ core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php | 6 +++--- core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/UserCacheContext.php | 2 ++ core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php | 4 ++++ core/modules/book/src/Cache/BookNavigationCacheContext.php | 2 ++ core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php | 4 ++++ .../entity_test/src/Cache/EntityTestViewGrantsCacheContext.php | 2 ++ .../modules/views_test_data/src/Cache/ViewsTestCacheContext.php | 2 ++ 20 files changed, 51 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php index 7afce73..f4d836e 100644 --- a/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php @@ -12,6 +12,8 @@ /** * Defines the AccountPermissionsCacheContext service, for "per permission" caching. + * + * Cache context ID: 'user.permissions'. */ class AccountPermissionsCacheContext extends UserCacheContext { diff --git a/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php index e7850b8..534d10c 100644 --- a/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php @@ -9,6 +9,10 @@ /** * Defines the CookiesCacheContext service, for "per cookie" caching. + * + * Cache context ID: 'cookies' (to vary by all cookies). + * Calculated cache context ID: 'cookies:%name', e.g. 'cookies:device_type' (to + * vary by the 'device_type' cookie). */ class CookiesCacheContext extends RequestStackCacheContextBase implements CalculatedCacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php b/core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php index 1644aa0..8286b36 100644 --- a/core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php @@ -9,6 +9,10 @@ /** * Defines the HeadersCacheContext service, for "per header" caching. + * + * Cache context ID: 'headers' (to vary by all headers). + * Calculated cache context ID: 'headers:%name', e.g. 'headers:X-Something' (to + * vary by the 'X-Something' header). */ class HeadersCacheContext extends RequestStackCacheContextBase implements CalculatedCacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php b/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php index 4841482..9cc6713 100644 --- a/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php @@ -9,6 +9,8 @@ /** * Defines the IpCacheContext service, for "per IP address" caching. + * + * Cache context ID: 'ip'. */ class IpCacheContext extends RequestStackCacheContextBase { diff --git a/core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php b/core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php index 3f27059..1f30cf1 100644 --- a/core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php @@ -9,6 +9,8 @@ /** * Defines the IsSuperUserCacheContext service, for "super user or not" caching. + * + * Cache context ID: 'user.is_super_user'. */ class IsSuperUserCacheContext extends UserCacheContext { diff --git a/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php index 23bdb7c..f53d464 100644 --- a/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php @@ -9,6 +9,10 @@ /** * Defines a cache context for "per page in a pager" caching. + * + * Cache context ID: 'url.query_args.pagers' (to vary by all pagers). + * Calculated cache context ID: 'url.query_args.pagers:%pager_id', e.g. + * 'url.query_args.pagers:1' (to vary by the pager with ID 1). */ class PagersCacheContext extends RequestStackCacheContextBase implements CalculatedCacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php index e9a7664..faceb07 100644 --- a/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php @@ -10,9 +10,9 @@ /** * Defines the QueryArgsCacheContext service, for "per query args" caching. * - * A "host" is defined as the combination of URI scheme, domain name and port. - * - * @see Symfony\Component\HttpFoundation::getSchemeAndHttpHost() + * Cache context ID: 'url.query_args' (to vary by all query arguments). + * Calculated cache context ID: 'url.query_args:%key', e.g.'url.query_args:foo' + * (to vary by the 'foo' query argument). */ class QueryArgsCacheContext extends RequestStackCacheContextBase implements CalculatedCacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php b/core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php index c3e544d..b6784f7 100644 --- a/core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php @@ -9,6 +9,8 @@ /** * Defines the RequestFormatCacheContext service, for "per format" caching. + * + * Cache context ID: 'request_format'. */ class RequestFormatCacheContext extends RequestStackCacheContextBase { diff --git a/core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php b/core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php index 0643d8b..bb4dd8d 100644 --- a/core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php @@ -11,6 +11,8 @@ /** * Defines the RouteCacheContext service, for "per route" caching. + * + * Cache context ID: 'route'. */ class RouteCacheContext implements CacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php b/core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php index dcca18b..487edc2 100644 --- a/core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php @@ -9,6 +9,8 @@ /** * Defines the RouteCacheContext service, for "per route name" caching. + * + * Cache context ID: 'route.name'. */ class RouteNameCacheContext extends RouteCacheContext { diff --git a/core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php b/core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php index 4e0c123..e4d28cb 100644 --- a/core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php @@ -10,6 +10,8 @@ /** * Defines the SiteCacheContext service, for "per site" caching. * + * Cache context ID: 'site'. + * * A "site" is defined as the combination of URI scheme, domain name, port and * base path. It allows for varying between the *same* site being accessed via * different entry points. (Different sites in a multisite setup have separate diff --git a/core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php b/core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php index 5f478ec..bafeb1b 100644 --- a/core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php @@ -12,6 +12,8 @@ /** * Defines the ThemeCacheContext service, for "per theme" caching. + * + * Cache context ID: 'theme'. */ class ThemeCacheContext implements CacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php b/core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php index 7e5b7c5..9b22e0e 100644 --- a/core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php @@ -10,6 +10,8 @@ /** * Defines the TimeZoneCacheContext service, for "per time zone" caching. * + * Cache context ID: 'timezone'. + * * @see \Drupal\Core\Session\AccountProxy::setAccount() */ class TimeZoneCacheContext implements CacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php index 1ea0bf0..c0b0453 100644 --- a/core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php @@ -9,6 +9,8 @@ /** * Defines the UrlCacheContext service, for "per page" caching. + * + * Cache context ID: 'url'. */ class UrlCacheContext extends RequestStackCacheContextBase { diff --git a/core/lib/Drupal/Core/Cache/Context/UserCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UserCacheContext.php index 80ad519..d7b8051 100644 --- a/core/lib/Drupal/Core/Cache/Context/UserCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UserCacheContext.php @@ -11,6 +11,8 @@ /** * Defines the UserCacheContext service, for "per user" caching. + * + * Cache context ID: 'user'. */ class UserCacheContext implements CacheContextInterface { diff --git a/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php index 375d80b..497a7c1 100644 --- a/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php @@ -9,6 +9,10 @@ /** * Defines the UserRolesCacheContext service, for "per role" caching. + * + * Cache context ID: 'user.roles' (to vary by all roles of the current user). + * Calculated cache context ID: 'user.roles:%role', e.g. 'user.roles:anonymous' + * (to vary by the presence/absence of a specific role). */ class UserRolesCacheContext extends UserCacheContext implements CalculatedCacheContextInterface{ diff --git a/core/modules/book/src/Cache/BookNavigationCacheContext.php b/core/modules/book/src/Cache/BookNavigationCacheContext.php index 15ce15a..04a09e8 100644 --- a/core/modules/book/src/Cache/BookNavigationCacheContext.php +++ b/core/modules/book/src/Cache/BookNavigationCacheContext.php @@ -14,6 +14,8 @@ /** * Defines the book navigation cache context service. * + * Cache context ID: 'route.book_navigation'. + * * This allows for book navigation location-aware caching. It depends on: * - whether the current route represents a book node at all * - and if so, where in the book hierarchy we are diff --git a/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php b/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php index 13ce366..12d833b 100644 --- a/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php +++ b/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php @@ -13,6 +13,10 @@ /** * Defines the node access view cache context service. * + * Cache context ID: 'user.node_grants' (to vary by all operations' grants). + * Calculated cache context ID: 'user.node_grants:%operation', e.g. + * 'user.node_grants:view' (to vary by the view operation's grants). + * * This allows for node access grants-sensitive caching when listing nodes. * * @see node_query_node_access_alter() diff --git a/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php b/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php index 1bc28f1..0b4b360 100644 --- a/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php +++ b/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php @@ -12,6 +12,8 @@ /** * Defines the entity_test view grants cache context service. * + * Cache context ID: 'entity_test_view_grants'. + * * @see \Drupal\node\Cache\NodeAccessViewGrantsCacheContext */ class EntityTestViewGrantsCacheContext implements CacheContextInterface { diff --git a/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php b/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php index b66ba38..25be646 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php +++ b/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php @@ -11,6 +11,8 @@ /** * Test cache context which uses a dynamic context coming from state. + * + * Cache context ID: 'views_test_cache_context'. */ class ViewsTestCacheContext implements CacheContextInterface {