/** * Puts all entries of the map into the cache in an more efficient way than * putting them as single entries with put(key, value) into it. * The key of the map must be a string, otherwise the toString Method is used for the key. * * @param \blaze\collections\Map $map The map which contains the entries which should be put into the cache * @return boolean true if all entries were put into the cache, otherwise false * @throws CacheException Is thrown when a key has less than one char. */ public function putAll(\blaze\collections\Map $map) { $newMap = new \blaze\collections\map\HashMap(); foreach ($map as $key => $value) { $newMap->put($this->key . '.' . self::getCheckedKey($key), $value); } return $this->cache->putAll($newMap); }
private static function getInitParams($node) { $initParams = new \blaze\collections\map\HashMap(); foreach ($node->childNodes as $child) { if ($child->localName == 'initParams') { foreach ($child->childNodes as $param) { $initParams->put($param->getAttribute('name'), $param->getAttribute('value')); } } } return $initParams; }
private function getActions($node) { $actions = new \blaze\collections\map\HashMap(); foreach ($node->childNodes as $child) { if ($child->nodeType == XML_ELEMENT_NODE && $child->localName == 'navigationAction') { $action = $child->getAttribute('action'); $view = $child->getAttribute('view'); $actions->put($action, $view); } } return $actions; }
/** * {@inheritDoc} */ public function getByRegex(\blaze\lang\String $regex) { $map = new \blaze\collections\map\HashMap(); foreach ($this->cacheDir->listFiles() as $file) { if ($file->getName()->matches($regex)) { $map->put($file->getFileName(), unserialize(file_get_contents($file->getAbsolutePath()))); } } return $map; }