diff --git a/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php index 5993424ae9a4a49e4863e11d97fbff312c91a44f..01e6ce8ab725143445315e2187d7ec5453211d5d 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 e7850b8c8cbc2404e49474f9fbc6b1fccb3d68c8..534d10c778aadfceb851c9cc6dd89f1eb67cc2ce 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 1644aa09c84269b81ccb5f593bc75bcfb376a751..8286b362d31e3ef5cb594c5d24d3232a78449d89 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 4841482f6bae1d95d576a93831e4e923f0e9b080..9cc6713986e6d7442c6533f0febd7c3db30bd561 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 3f27059638d073416b198a556c9dcdcf2ccd5392..1f30cf1562a9c6ff7359b79963d04f9a2daa2aa1 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 23bdb7c99dc5e60abffd9bf9ee71926fc345819d..f53d46457216d50fc6c630adb982b63f48291560 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 e9a76649836c06a7be0038d3f1c72cd65346bef7..faceb076c9995fcb1cef6cf6f63290932954531c 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 c3e544d83490280dfc0355af1a6f64df808ba359..b6784f7b89a5440507ebe8ae7c27445f4637d5d4 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 0643d8bf0ffded4e63ad8bbe1dd2826dbc8ef54e..bb4dd8d625fb5d5374b49b3f8911ed9331c59fb1 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 dcca18b8ff1834a215db8fcad65c651ffa70216f..487edc288b0d2c55b3dcf1eee8bca687c365a075 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 4e0c123f51191303d03ce1fad1efe226f63469ac..e4d28cb4c3c430ae87d77ad7c80f43ec4ed2d0de 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 85ba1a78975b0fd958b0ac73fd84e4896296a020..0a66878b0f8cffc772854e0b23d6ea567748ddb8 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 7e5b7c5c94d9734cdaa2423bfe50adf15fa458e0..9b22e0e286f939d7ecb5a2d891c64b57cc48a3fe 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 1ea0bf03ebdf9c0783519dfe41c248eb280eac3a..c0b0453d6a169649e2b498b24a5ad7de45324a0f 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 80ad5191e60febce0499c08b6ddb1a95ab189eb1..d7b80517bf86d1791683ff70030a34ff0d003dc8 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 55cca784fd02387c63b2193c098169b8e0271d4a..e4bb71a3f5258a82f8a5f6f241f0890b4f082e20 100644 --- a/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php @@ -12,6 +12,10 @@ * * Only use this cache context when checking explicitly for certain roles. Use * user.permissions for anything that checks permissions. + * + * 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 15ce15ad85a1bb737f22a125c8d090835dc7dab8..04a09e8dd4fbadb3996e581fea7c95e76affd19b 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 a0249f081c151f51261a792a7477ef6fd1edcd9c..912309f4223664191ddb202d042372ea35656577 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 1bc28f11c89ab4021f93a95aaffd2803e1427bb6..0b4b360d5fc13169770cbc959dceab415f838220 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 b66ba3830a536a3558f4047194ac0b2aa44ef255..25be6468fe757c2988781c5e4b92ba3b93453fdf 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 {