/**
  * 
  * "Removes" an item from the Children array, but by default not using PHP's 
  * unset() function becuase this will cause PHP to reset its internal array 
  * pointer and we need to maintain array state. Use the $force param to unset.
  * 
  * @param int $childID
  * @param boolean $force    Invoke PHP's unset() function on the selected item.
  * @return void
  */
 public function removeChild($childID, $force = true)
 {
     if (isset($this->Children[$childID])) {
         if ($force === true) {
             unset($this->Children[$childID]);
         } else {
             $this->Children[$childID] = CacheableSiteTree::create();
             // dummy
         }
     }
 }
 /**
  * 
  * "Refreshes" (Removes and builds) a cache-entry for the object (page) given
  * in $this->get_model().
  * 
  * Note: If a cache entry already exists for a given object ID, it is removed 
  * and replaced.
  * 
  * @param boolean $forceRemoval Whether to unset() children in {@link CacheableSiteTree::removeChild()}.
  * @return boolean              False if the underlying calls to {@link Zend_Cache_Core::load()}
  *                              or {@link Zend_Cache_Core::save()} fail for any reason.
  */
 public function refreshCachedPage($forceRemoval = false)
 {
     $model = $this->get_model();
     $cacheableClass = 'CacheableSiteTree';
     $classes = array_reverse(ClassInfo::ancestry(get_class($model)));
     foreach ($classes as $class) {
         if (class_exists($cachedDataClass = 'Cacheable' . $class)) {
             $cacheableClass = $cachedDataClass;
             break;
         }
     }
     $cacheable = CacheableDataModelConvert::model2cacheable($model, $cacheableClass);
     $frontend = $this->getCacheableFrontEnd();
     $id = $this->getIdentifier();
     if (!$this->_cached) {
         if (!($cached = $frontend->load($id))) {
             return false;
         }
         $this->_cached = $cached;
     }
     $site_map = $this->_cached->get_site_map();
     if (isset($site_map[$cacheable->ID])) {
         $parentCached = $site_map[$cacheable->ID]->getParent();
         if ($parentCached && $parentCached->ID && isset($site_map[$parentCached->ID])) {
             $site_map[$parentCached->ID]->removeChild($cacheable->ID, $forceRemoval);
         }
         $children = $site_map[$cacheable->ID]->getAllChildren();
         if (count($children)) {
             foreach ($children as $child) {
                 $cacheable->addChild($child);
                 $child->setParent($cacheable);
             }
         }
         unset($site_map[$cacheable->ID]);
     }
     $root_elements = $this->_cached->get_root_elements();
     if ($cacheable->ParentID) {
         if (!isset($site_map[$cacheable->ParentID])) {
             $parent = new CacheableSiteTree();
             $parent->ID = $cacheable->ParentID;
             $parent->addChild($cacheable);
             $cacheable->setParent($parent);
             $site_map[$cacheable->ParentID] = $parent;
         } else {
             $site_map[$cacheable->ParentID]->addChild($cacheable);
             $cacheable->setParent($site_map[$cacheable->ParentID]);
         }
         if (isset($root_elements[$cacheable->ID])) {
             unset($root_elements[$cacheable->ID]);
         }
     } else {
         $root_elements[$cacheable->ID] = $cacheable;
     }
     $site_map[$cacheable->ID] = $cacheable;
     $this->_cached->set_site_map($site_map);
     $this->_cached->set_root_elements($root_elements);
     $frontend->remove($id);
     return $frontend->save($this->_cached, $id, array(self::get_default_cache_tag()));
 }