Commit 233c9ea5 authored by alexpott's avatar alexpott

Issue #2443323 by Wim Leers, Nitesh Sethia, yched, Fabianx, jhodgdon: New...

Issue #2443323 by Wim Leers, Nitesh Sethia, yched, Fabianx, jhodgdon: New convention: CacheContextInterface implementations should mention their ID in their class-level docblock
parent a66929cb
......@@ -12,6 +12,8 @@
/**
* Defines the AccountPermissionsCacheContext service, for "per permission" caching.
*
* Cache context ID: 'user.permissions'.
*/
class AccountPermissionsCacheContext extends UserCacheContext {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -9,6 +9,8 @@
/**
* Defines the IpCacheContext service, for "per IP address" caching.
*
* Cache context ID: 'ip'.
*/
class IpCacheContext extends RequestStackCacheContextBase {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -9,6 +9,8 @@
/**
* Defines the RequestFormatCacheContext service, for "per format" caching.
*
* Cache context ID: 'request_format'.
*/
class RequestFormatCacheContext extends RequestStackCacheContextBase {
......
......@@ -11,6 +11,8 @@
/**
* Defines the RouteCacheContext service, for "per route" caching.
*
* Cache context ID: 'route'.
*/
class RouteCacheContext implements CacheContextInterface {
......
......@@ -9,6 +9,8 @@
/**
* Defines the RouteCacheContext service, for "per route name" caching.
*
* Cache context ID: 'route.name'.
*/
class RouteNameCacheContext extends RouteCacheContext {
......
......@@ -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
......
......@@ -12,6 +12,8 @@
/**
* Defines the ThemeCacheContext service, for "per theme" caching.
*
* Cache context ID: 'theme'.
*/
class ThemeCacheContext implements CacheContextInterface {
......
......@@ -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 {
......
......@@ -9,6 +9,8 @@
/**
* Defines the UrlCacheContext service, for "per page" caching.
*
* Cache context ID: 'url'.
*/
class UrlCacheContext extends RequestStackCacheContextBase {
......
......@@ -11,6 +11,8 @@
/**
* Defines the UserCacheContext service, for "per user" caching.
*
* Cache context ID: 'user'.
*/
class UserCacheContext implements CacheContextInterface {
......
......@@ -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{
......
......@@ -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
......
......@@ -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()
......
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment