expire() public method

Expire any existing data for the given key.
public expire ( string $key ) : boolean
$key string Cache key to expire.
return boolean Success or failure.
コード例 #1
0
ファイル: Cache.php プロジェクト: horde/horde
 /**
  * Delete a mailbox from the cache.
  *
  * @param string $mbox  The mailbox to delete.
  */
 protected function _deleteMailbox($mbox)
 {
     foreach (array_merge(array_keys(array_flip($this->_slicemap[$mbox]['s'])), array('slicemap')) as $slice) {
         $cid = $this->_getCid($mbox, $slice);
         $this->_cache->expire($cid);
         unset($this->_loaded[$cid]);
     }
     unset($this->_data[$mbox], $this->_slicemap[$mbox], $this->_update[$mbox]);
 }
コード例 #2
0
ファイル: Friends.php プロジェクト: jubinpatel/horde
 /**
  * Approve our friend to add us to his userlist
  *
  * @param string $friend  Friend username
  */
 public function approveFriend($friend)
 {
     $result = $this->_approveFriend($friend);
     if ($result instanceof PEAR_Error) {
         return $result;
     }
     $this->_cache->expire('folksFriends' . $friend);
     $this->_cache->expire('folksFriends' . $this->_user);
     return true;
 }
コード例 #3
0
ファイル: Cache.php プロジェクト: netcon-source/apps
 /**
  * Delete a mailbox from the cache.
  *
  * @param string $mbox  The mailbox to delete.
  */
 protected function _deleteMailbox($mbox)
 {
     foreach (array_merge(array_keys(array_flip($this->_slicemap[$mbox]['s'])), array('slicemap')) as $slice) {
         $cid = $this->_getCid($mbox, $slice);
         $this->_cache->expire($cid);
         unset($this->_loaded[$cid]);
     }
     unset($this->_data[$mbox], $this->_slicemap[$mbox], $this->_update[$mbox]);
     if ($this->_params['debug']) {
         $this->_base->writeDebug('CACHE: Deleted mailbox (mailbox: ' . $mbox . ")\n", Horde_Imap_Client::DEBUG_INFO);
     }
 }
コード例 #4
0
ファイル: Base.php プロジェクト: horde/horde
 /**
  * Removes a group.
  *
  * @param mixed $gid  A group ID.
  *
  * @throws Horde_Group_Exception
  */
 public function remove($gid)
 {
     // Remove group.
     $this->_remove($gid);
     // Update caches.
     if (($list = $this->_getListCache()) !== null) {
         unset($list[$gid]);
         $this->_setListCache($list);
     }
     try {
         $this->_cache->expire($this->_sig('name_' . $gid));
         $this->_cache->expire($this->_sig('data_' . $gid));
         $this->_cache->set($this->_sig('exists_' . $gid), 0);
     } catch (Horde_Cache_Exception $e) {
     }
 }
コード例 #5
0
ファイル: History.php プロジェクト: jubinpatel/horde
 /**
  * Logs an event to an item's history log.
  *
  * The item must be uniquely identified by $guid. Any other details about
  * the event are passed in $attributes. Standard suggested attributes are:
  * - who: The id of the user that performed the action (will be added
  *        automatically if not present).
  * - ts:  Timestamp of the action (this will be added automatically if it
  *        is not present).
  *
  * @param string  $guid          The unique identifier of the entry to add
  *                               to.
  * @param array   $attributes    The hash of name => value entries that
  *                               describe this event.
  * @param boolean $replaceAction If $attributes['action'] is already
  *                               present in the item's history log, update
  *                               that entry instead of creating a new one.
  *
  * @throws Horde_History_Exception
  */
 public function log($guid, array $attributes = array(), $replaceAction = false)
 {
     if (!is_string($guid)) {
         throw new InvalidArgumentException('The guid needs to be a string!');
     }
     $history = $this->getHistory($guid);
     if (!isset($attributes['who'])) {
         $attributes['who'] = $this->_auth;
     }
     if (!isset($attributes['ts'])) {
         $attributes['ts'] = time();
     }
     $this->_log($history, $attributes, $replaceAction);
     if ($this->_cache) {
         $this->_cache->expire('horde:history:' . $guid);
     }
 }
コード例 #6
0
ファイル: Driver.php プロジェクト: horde/horde
 /**
  * Saves a forum, either creating one if no forum ID is given or updating
  * an existing one.
  *
  * @param array $info  The forum information to save consisting of:
  *                       forum_id
  *                       forum_author
  *                       forum_parent_id
  *                       forum_name
  *                       forum_moderated
  *                       forum_description
  *                       forum_attachments
  *
  * @return integer  The forum ID on success.
  * @throws Agora_Exception
  */
 public function saveForum($info)
 {
     if (empty($info['forum_id'])) {
         if (empty($info['author'])) {
             $info['author'] = $GLOBALS['registry']->getAuth();
         }
         $info['forum_id'] = $this->newForum($info['forum_name'], $info['author']);
     }
     $sql = 'UPDATE ' . $this->_forums_table . ' SET forum_name = ?, forum_parent_id = ?, ' . 'forum_description = ?, forum_moderated = ?, ' . 'forum_attachments = ?, forum_distribution_address = ? ' . 'WHERE forum_id = ?';
     $values = array($this->convertToDriver($info['forum_name']), (int) $info['forum_parent_id'], $this->convertToDriver($info['forum_description']), (int) $info['forum_moderated'], isset($info['forum_attachments']) ? (int) $info['forum_attachments'] : abs($GLOBALS['conf']['forums']['enable_attachments']), isset($info['forum_distribution_address']) ? $info['forum_distribution_address'] : '', $info['forum_id']);
     try {
         $this->_db->execute($sql, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Agora_Exception($e->getMessage());
     }
     $this->_updateCacheState(0);
     $this->_cache->expire('agora_forum_' . $info['forum_id'], $GLOBALS['conf']['cache']['default_lifetime']);
     return $info['forum_id'];
 }
コード例 #7
0
ファイル: Sql.php プロジェクト: raz0rsdge/horde
 /**
  * Saves any changes to this object to the backend permanently. New
  * objects are added instead.
  *
  * @throws Horde_Perms_Exception
  */
 public function save()
 {
     if (!isset($this->_db)) {
         throw new Horde_Perms_Exception('Cannot save because the DB instances has not been set in this object.');
     }
     $name = $this->getName();
     if (empty($name)) {
         throw new Horde_Perms_Exception('Permission names must be non-empty');
     }
     $query = 'UPDATE horde_perms SET perm_data = ? WHERE perm_id = ?';
     $params = array(serialize($this->data), $this->getId());
     try {
         $this->_db->update($query, $params);
     } catch (Horde_Db_Exception $e) {
         throw new Horde_Perms_Exception($e);
     }
     $this->_cache->expire('perm_sql_' . $this->_cacheVersion . $name);
     $this->_cache->expire('perm_sql_exists_' . $this->_cacheVersion . $name);
 }
コード例 #8
0
ファイル: Cache.php プロジェクト: jubinpatel/horde
 /**
  * Delete a cached attachment.
  *
  * @param string $data_id       ID of the data set.
  * @param string $obid          Object backend id.
  * @param string $attachment_id Attachment ID.
  *
  * @return NULL
  */
 public function deleteAttachment($data_id, $obid, $attachment_id)
 {
     return $this->horde_cache->expire($this->_getAttachmentId($data_id, $obid, $attachment_id));
 }