/**
  * Delete any feature bucket $object would be contained in from the cache
  *
  * @param object $object
  * @param array $row
  * @throws DataModelException
  */
 public function cachePurge($object, array $row)
 {
     $indexed = ObjectManager::splitFromRow($row, $this->indexed);
     if (!$indexed) {
         throw new DataModelException('Un-indexable row: ' . FormatJson::encode($row), 'process-data');
     }
     // We don't want to just remove this object from the index, then the index would be incorrect.
     // We want to delete the bucket that contains this object.
     $this->cache->delete($this->cacheKey($indexed));
 }
 protected function appendToSubtreeCache(UUID $descendant, array $rootPath)
 {
     $callback = function (BagOStuff $cache, $key, $value) use($descendant) {
         if ($value === false) {
             return false;
         }
         $value[$descendant->getAlphadecimal()] = $descendant;
         return $value;
     };
     // This could be pretty slow if there is contention
     foreach ($rootPath as $subtreeRoot) {
         $cacheKey = $this->cacheKey('subtree', $subtreeRoot);
         $success = $this->cache->merge($cacheKey, $callback);
         // $success is always true if bufferCache starts with begin()
         // if we failed to CAS new data, kill the cached value so it'll be
         // re-fetched from DB
         if (!$success) {
             $this->cache->delete($cacheKey);
         }
     }
 }