set() публичный Метод

Store information in cache.
public set ( string $mailbox, array $data, integer $uidvalid )
$mailbox string An IMAP mailbox string.
$data array The list of data to save. The keys are the UIDs, the values are an array of information to save. If empty, do a check to make sure the uidvalidity is still valid.
$uidvalid integer The IMAP uidvalidity value of the mailbox.
Пример #1
0
 /**
  * Moves cache entries from the current mailbox to another mailbox.
  *
  * @param Horde_Imap_Client_Mailbox $to  The destination mailbox.
  * @param array $map                     Mapping of source UIDs (keys) to
  *                                       destination UIDs (values).
  * @param string $uidvalid               UIDVALIDITY of destination
  *                                       mailbox.
  *
  * @throws Horde_Imap_Client_Exception
  */
 protected function _moveCache(Horde_Imap_Client_Mailbox $to, $map, $uidvalid)
 {
     if (!$this->_initCache()) {
         return;
     }
     $c = $this->getParam('cache');
     if (in_array(strval($to), $c['fetch_ignore'])) {
         $this->_debug->info(sprintf('CACHE: Ignoring moving FETCH data (%s => %s)', $this->_selected, $to));
         return;
     }
     $old = $this->_cache->get($this->_selected, array_keys($map), null);
     $new = array();
     foreach ($map as $key => $val) {
         if (!empty($old[$key])) {
             $new[$val] = $old[$key];
         }
     }
     if (!empty($new)) {
         $this->_cache->set($to, $new, $uidvalid);
     }
 }
Пример #2
0
 /**
  * Moves cache entries from one mailbox to another.
  *
  * @param string $from      The source mailbox (UTF7-IMAP).
  * @param string $to        The destination mailbox (UTF7-IMAP).
  * @param array $map        Mapping of source UIDs (keys) to destination
  *                          UIDs (values).
  * @param string $uidvalid  UIDVALIDITY of destination mailbox.
  *
  * @throws Horde_Imap_Client_Exception
  */
 protected function _moveCache($from, $to, $map, $uidvalid = null)
 {
     if (!$this->_initCache()) {
         return;
     }
     if (in_array($to, $this->_params['cache']['fetch_ignore'])) {
         $this->writeDebug(sprintf("IGNORING moving cached FETCH data (%s => %s)\n", $from, $to), Horde_Imap_Client::DEBUG_INFO);
         return;
     }
     if (is_null($uidvalid)) {
         $status_res = $this->status($to, Horde_Imap_Client::STATUS_UIDVALIDITY);
         $uidvalid = $status_res['uidvalidity'];
     }
     $old_data = $this->_cache->get($from, array_keys($map), null);
     $new_data = array();
     foreach ($map as $key => $val) {
         if (!empty($old_data[$key])) {
             $new_data[$val] = $old_data[$key];
         }
     }
     if (!empty($new_data)) {
         $this->_cache->set($to, $new_data, $uidvalid);
     }
 }