3 namespace Drupal\Core\Cache\Context;
5 use Drupal\Core\Cache\CacheableMetadata;
8 * Defines the TimeZoneCacheContext service, for "per time zone" caching.
10 * Cache context ID: 'timezone'.
12 * @see \Drupal\Core\Session\AccountProxy::setAccount()
14 class TimeZoneCacheContext implements CacheContextInterface {
19 public static function getLabel() {
20 return t("Time zone");
26 public function getContext() {
27 // date_default_timezone_set() is called in AccountProxy::setAccount(), so
28 // we can safely retrieve the timezone.
29 return date_default_timezone_get();
35 public function getCacheableMetadata() {
36 return new CacheableMetadata();