You are here

public function purl_cache::remove in Persistent URL 6

Same name and namespace in other branches
  1. 7 purl.module \purl_cache::remove()

Parameters

$method: Optional method to remove the cache for.

$provider: Optional provider to remove the cache for.

File

./purl.module, line 878

Class

purl_cache
Specialized cache for storing modifier information.

Code

public function remove($method = NULL, $provider = NULL) {
  if (isset($provider)) {
    $methods = isset($method) ? array(
      $method,
    ) : array_keys($this->cache);
    foreach ($methods as $method) {
      if (isset($this->cache[$method])) {
        foreach ($this->cache[$method] as $key => $item) {
          if (is_object($item) && !empty($item->provider) && $item->provider == $provider) {
            unset($this->cache[$method][$key]);
          }
        }
      }
    }
  }
  else {
    if (isset($method)) {
      if (isset($this->cache[$method])) {
        unset($this->cache[$method]);
      }
    }
  }
  return $this;
}