Drupal 8  8.0.2
SiteCacheContext Class Reference
Inheritance diagram for SiteCacheContext:

Public Member Functions

 getContext ()
 
 getCacheableMetadata ()
 
- Public Member Functions inherited from RequestStackCacheContextBase
 __construct (RequestStack $request_stack)
 

Static Public Member Functions

static getLabel ()
 

Additional Inherited Members

- Protected Attributes inherited from RequestStackCacheContextBase
 $requestStack
 

Detailed Description

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 databases.) For example: http://example.com and http://www.example.com.

See Also
::getSchemeAndHttpHost()
::getBaseUrl()

Member Function Documentation

getCacheableMetadata ( )

{Gets the cacheability metadata for the context.There are three valid cases for the returned CacheableMetadata object:

  • An empty object means this can be optimized away safely.
  • A max-age of 0 means that this context can never be optimized away. It will never bubble up and cache tags will not be used.
  • Any non-zero max-age and cache tags will bubble up into the cache item if this is optimized away to allow for invalidation if the context value changes.
Returns
A cacheable metadata object.
}

Implements CacheContextInterface.

getContext ( )

{Returns the string representation of the cache context.A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.

Returns
string The string representation of the cache context.
}

Implements CacheContextInterface.

References Drupal\requestStack().

Here is the call graph for this function:

static getLabel ( )
static

{Returns the label of the cache context.

Returns
string The label of the cache context.
}

Implements CacheContextInterface.

References t().

Here is the call graph for this function:


The documentation for this class was generated from the following file: