Exemplo n.º 1
0
 /**
  * Updates the cache.
  */
 public function save()
 {
     foreach ($this->_update as $mbox => $val) {
         try {
             if (!empty($val['u'])) {
                 $ptr =& $this->_data[$mbox];
                 foreach ($this->_getMsgCids($mbox, array_keys($val['u'])) as $k2 => $v2) {
                     try {
                         $this->_hash->set($v2, $this->_pack->pack($ptr[$k2]), array('expire' => $this->_params['lifetime']));
                     } catch (Horde_Pack_Exception $e) {
                         $this->deleteMsgs($mbox, array($v2));
                         $val['d'][] = $v2;
                     }
                 }
             }
             if (!empty($val['d'])) {
                 $this->_hash->delete(array_values($this->_getMsgCids($mbox, $val['d'])));
             }
             if (!empty($val['m'])) {
                 try {
                     $this->_hash->set($this->_getCid($mbox), $this->_pack->pack($this->_mbox[$mbox]), array('expire' => $this->_params['lifetime']));
                 } catch (Horde_Pack_Exception $e) {
                 }
             }
         } catch (Horde_Exception $e) {
         }
     }
     $this->_update = array();
 }
Exemplo n.º 2
0
 /**
  */
 public function destroy($id)
 {
     $res = $this->_hash->delete($id);
     $this->_hash->unlock($id);
     if ($res === false) {
         return false;
     }
     if (!empty($this->_params['track'])) {
         $this->_hash->lock($this->_trackID);
         if ($ids = $this->_getTrackIds()) {
             unset($ids[$id]);
             $this->_hash->set($this->_trackID, json_encode($ids));
         }
         $this->_hash->unlock($this->_trackID);
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  */
 public function expire($key)
 {
     $this->_hash->delete(array($this->_getKey($key), $this->_getKey($key, true)));
 }