You are here

protected function CacheDecoratedResource::invalidateResourceCache in RESTful 7.2

Invalidates the resource cache for the given resource on the provided id.

Parameters

string $id: The id.

3 calls to CacheDecoratedResource::invalidateResourceCache()
CacheDecoratedResource::remove in src/Plugin/resource/Decorators/CacheDecoratedResource.php
Basic implementation for update.
CacheDecoratedResource::replace in src/Plugin/resource/Decorators/CacheDecoratedResource.php
Basic implementation for update.
CacheDecoratedResource::update in src/Plugin/resource/Decorators/CacheDecoratedResource.php
Basic implementation for update.

File

src/Plugin/resource/Decorators/CacheDecoratedResource.php, line 305
Contains \Drupal\restful\Plugin\resource\Decorators\CacheDecoratedResource

Class

CacheDecoratedResource

Namespace

Drupal\restful\Plugin\resource\Decorators

Code

protected function invalidateResourceCache($id) {

  // Invalidate the render cache for this resource.
  $query = new \EntityFieldQuery();
  $canonical_id = $this
    ->getDataProvider()
    ->canonicalPath($id);
  $query
    ->entityCondition('entity_type', 'cache_fragment')
    ->propertyCondition('type', 'resource')
    ->propertyCondition('value', $this::serializeKeyValue($this
    ->getResourceName(), $canonical_id));
  foreach (CacheFragmentController::lookUpHashes($query) as $hash) {
    $this
      ->getCacheController()
      ->clear($hash);
  }
}