You are here

public function context_prefix_cache::add in Context 5

Parameters

$method: The method to add to the cache for

$item: Either a integer|string, or keyed array to add

$merge: Preserve keys and merge into cache for method.

File

context_prefix/context_prefix.module, line 849

Class

context_prefix_cache
Specialized cache for storing prefix information.

Code

public function add($method, $item, $merge = true) {
  if (is_array($item) && $merge) {

    // Need to preserve keys so we use the '+' array operator.
    $this->cache[$method] = $this->cache[$method] + $item;
  }
  else {
    $this->cache[$method][] = $item;
  }
}