예제 #1
0
 /**
  * @param BlockData $blockData
  */
 public function applyBlock(BlockData $blockData)
 {
     $this->db->updateUtxoSet($this->outpointSerializer, $blockData);
     if ($this->caching) {
         foreach ($this->cacheHits as $key) {
             $this->set->delete($key);
         }
         foreach ($blockData->remainingNew as $c => $utxo) {
             $new = $this->outpointSerializer->serialize($utxo->getOutPoint())->getBinary();
             $this->set->save($new, [$utxo->getOutput()->getValue(), $utxo->getOutput()->getScript()->getBinary()], 500000);
         }
         echo "Inserts: " . count($blockData->remainingNew) . " | Deletes: " . count($blockData->requiredOutpoints) . " | " . "CacheHits: " . count($this->cacheHits) . PHP_EOL;
         $this->cacheHits = [];
     }
 }
예제 #2
0
파일: Flexistore.php 프로젝트: kisma/kisma
 /**
  * Fetches an entry from the cache.
  *
  * @param string $id           The id of the cache entry to fetch
  * @param mixed  $defaultValue The default value if $id not found
  * @param bool   $remove
  *
  * @return mixed The cached data or FALSE, if no cache entry exists for the given id.
  */
 public function get($id, $defaultValue = null, $remove = false)
 {
     if (false === ($_data = $this->_store->fetch($id))) {
         if (!$remove) {
             $this->_store->save($id, $_data = $defaultValue);
         }
     } elseif ($remove) {
         $this->_store->delete($id);
     }
     return $_data;
 }
예제 #3
0
 public function delete($prefix, $id)
 {
     $this->redis_cache->setNamespace($prefix);
     return $this->redis_cache->delete($id);
 }