public function purl_cache::add in Persistent URL 6
Same name and namespace in other branches
- 7 purl.module \purl_cache::add()
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
- ./
purl.module, line 816
Class
- purl_cache
- Specialized cache for storing modifier information.
Code
public function add($method, $item, $merge = true) {
if (is_array($item) && $merge) {
// Need to preserve keys so we use the '+' array operator.
if (!isset($this->cache[$method]) && count($item) >= 1) {
$this->cache[$method] = array();
}
if (count($item) >= 1) {
$this->cache[$method] = $this->cache[$method] + $item;
}
}
else {
$this->cache[$method][] = $item;
}
return $this;
}