You are here

public function StoreCacheContext::getContext in Commerce Core 8.2

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.

Return value

string The string representation of the cache context.

Overrides CacheContextInterface::getContext

File

modules/store/src/Cache/Context/StoreCacheContext.php, line 43

Class

StoreCacheContext
Defines the StoreCacheContext service, for "per store" caching.

Namespace

Drupal\commerce_store\Cache\Context

Code

public function getContext() {
  $store = $this->currentStore
    ->getStore();
  return $store ? $store
    ->id() : '0';
}