Beispiel #1
0
 public function set($key, $value, $ttl = false)
 {
     if (!$ttl) {
         $ttl = Shindig_Config::Get('cache_time');
     }
     if ($this->storage->isLocked($key)) {
         $this->storage->waitForLock($key);
     }
     $data = serialize(array('time' => $this->time->getRequestTime(), 'ttl' => $ttl, 'valid' => true, 'data' => $value));
     $this->storage->lock($key);
     try {
         $this->storage->store($key, $data);
         $this->storage->unlock($key);
     } catch (Exception $e) {
         $this->storage->unlock($key);
         throw $e;
     }
 }