You are here

public function RestfulBase::cacheInvalidate in RESTful 7

Invalidates cache for a certain entity.

Parameters

string $cid: The wildcard cache id to invalidate. Do not add * for the wildcard.

2 calls to RestfulBase::cacheInvalidate()
RestfulBase::clearResourceRenderedCache in plugins/restful/RestfulBase.php
Clear all caches corresponding to the current resource.
RestfulEntityBase::clearResourceRenderedCacheEntity in plugins/restful/RestfulEntityBase.php
Clear all caches corresponding to the current resource for a given entity.

File

plugins/restful/RestfulBase.php, line 1401
Contains RestfulBase.

Class

RestfulBase
Class \RestfulBase

Code

public function cacheInvalidate($cid) {
  $cache_info = $this
    ->getPluginKey('render_cache');
  if (!$cache_info['render'] || !$cache_info['simple_invalidate']) {

    // Simple invalidation is disabled. This means it is up to the
    // implementing module to take care of the invalidation.
    return;
  }

  // If the $cid is not '*' then remove the asterisk since it can mess with
  // dynamically built wildcards.
  if ($cid != '*') {
    $pos = strpos($cid, '*');
    if ($pos !== FALSE) {
      $cid = substr($cid, 0, $pos);
    }
  }
  $this
    ->getCacheController()
    ->clear($cid, TRUE);
}