Example #1
0
 /**
  * @param string $methodName
  * @param array $arguments
  * @param string $callback
  * @param int $ttl
  * @return mixed
  */
 protected function cacheRetrieverSet($methodName, $arguments, $callback, $ttl = 0)
 {
     $key = $this->getStorageGUID() . $methodName . ':' . md5(serialize($arguments));
     $ignoreCache = $this->ignoreCache();
     $foundData = false;
     if (!$ignoreCache) {
         $data = $this->_memcached->get($key);
         if ($this->_memcached->getResultCode() !== Memcached::RES_NOTFOUND) {
             $result = unserialize($data);
             $foundData = true;
         }
     }
     if (!$foundData) {
         $result = call_user_func_array(array($this->_reader, $callback), $arguments);
         $this->_memcached->set($key, serialize($result), $ttl);
     }
     return $result;
 }
Example #2
0
 protected function _insert(Berthe_AbstractVO &$vo)
 {
     return self::$_memcached->set($this->getMemcachedKey($vo->id), $vo);
 }