You are here

public function CacheableValue::__construct in GraphQL 8.3

CacheableValue constructor.

Parameters

mixed $value: The actual value to be wrapped.

array $dependencies: An array of cache dependencies.

File

src/GraphQL/Cache/CacheableValue.php, line 35

Class

CacheableValue
Wrapper class for transporting cache metadata for resolved values.

Namespace

Drupal\graphql\GraphQL\Cache

Code

public function __construct($value, array $dependencies = []) {
  $this->value = $value;
  if ($value instanceof CacheableDependencyInterface) {
    $this
      ->addCacheableDependency($value);
  }
  foreach ($dependencies as $dependency) {
    if ($dependency instanceof CacheableDependencyInterface) {
      $this
        ->addCacheableDependency($dependency);
    }
  }
}