Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. IpCacheContext.php

function IpCacheContext::getContext

Overrides CacheContextInterface::getContext

File

core/lib/Drupal/Core/Cache/Context/IpCacheContext.php, line 24

Class

IpCacheContext
Defines the IpCacheContext service, for "per IP address" caching.

Namespace

Drupal\Core\Cache\Context

Code

public function getContext() {
    return $this->requestStack
        ->getCurrentRequest()
        ->getClientIp();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal