Example #1
0
 /**
  * Store data into Zend Data Disk Cache
  *
  * @param  string $internalKey
  * @param  mixed  $value
  * @param  int    $ttl
  * @return void
  * @throws Exception\RuntimeException
  */
 protected function zdcStore($internalKey, $value, $ttl)
 {
     if (!zend_disk_cache_store($internalKey, $value, $ttl)) {
         $valueType = gettype($value);
         throw new Exception\RuntimeException("zend_disk_cache_store({$internalKey}, <{$valueType}>, {$ttl}) failed");
     }
 }
Example #2
0
File: Disk.php Project: rexmac/zf2
 /**
  * Store data
  *
  * @param mixed  $data        Object to store
  * @param string $id          Cache id
  * @param int    $timeToLive  Time to live in seconds
  * @return boolean true if no problem
  */
 protected function _store($data, $id, $timeToLive)
 {
     if (zend_disk_cache_store($this->_options['namespace'] . '::' . $id, $data, $timeToLive) === false) {
         $this->_log('Store operation failed.');
         return false;
     }
     return true;
 }
Example #3
0
 /**
  * @param \Psr\Cache\CacheItemInterface $item
  * @return mixed
  * @throws \InvalidArgumentException
  */
 protected function driverWrite(CacheItemInterface $item)
 {
     /**
      * Check for Cross-Driver type confusion
      */
     if ($item instanceof Item) {
         $ttl = $item->getExpirationDate()->getTimestamp() - time();
         return zend_disk_cache_store($item->getKey(), $this->driverPreWrap($item), $ttl > 0 ? $ttl : 0);
     } else {
         throw new \InvalidArgumentException('Cross-Driver type confusion detected');
     }
 }
Example #4
0
 /**
  * Add to the cache
  *
  * Add a new variable to the cache that you will then be able
  * to retrieve using the $this->get($name) method.
  *
  * @param  string  $name   The name of the cache variable to store.
  * @param  string  $value  The value of the cache variable to store.
  * @param  integer $expire When should it expire? Default: 900 seconds.
  * 
  * @return boolean       Depending on the success of the operation, 
  *                       either true or false. 
  */
 public function add($name, $value, $expiry = 900)
 {
     return zend_disk_cache_store($name, $value, $expiry);
 }
Example #5
0
 public function set($key, $value, $ttl = 0)
 {
     $safeKey = $this->makeKey($key);
     $ret = @zend_disk_cache_store($safeKey, $value, $ttl);
     return $ret;
 }
 /**
  * {@inheritdoc}
  */
 public function put($key, $data, $ttl = 0)
 {
     return zend_disk_cache_store($key, $data, $ttl);
 }
Example #7
0
 protected function _set($key, $data, $ttl)
 {
     if (zend_disk_cache_store($this->key($key), $data, $ttl) === false) {
         throw new \fluxbb\cache\Exception('Unable to write Zend Disk cache: ' . $key);
     }
 }
 /**
  * Write datas on $uid key
  * @param mixed $uid
  * @param mixed $mixed
  */
 public function write($uid, $mixed)
 {
     return zend_disk_cache_store($uid, $mixed);
 }