本文整理汇总了PHP中rcube_db::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP rcube_db::reset方法的具体用法?PHP rcube_db::reset怎么用?PHP rcube_db::reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rcube_db
的用法示例。
在下文中一共展示了rcube_db::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read_record
/**
* Reads cache entry.
*
* @param string $key Cache key name
* @param boolean $nostore Enable to skip in-memory store
*
* @return mixed Cached value
*/
private function read_record($key, $nostore = false)
{
if (!$this->db) {
return null;
}
if ($this->type != 'db') {
$this->load_index();
// Consistency check (#1490390)
if (!in_array($key, $this->index)) {
// we always check if the key exist in the index
// to have data in consistent state. Keeping the index consistent
// is needed for keys delete operation when we delete all keys or by prefix.
} else {
$ckey = $this->ckey($key);
if ($this->type == 'memcache') {
$data = $this->db->get($ckey);
} else {
if ($this->type == 'apc') {
$data = apc_fetch($ckey);
}
}
if ($this->debug) {
$this->debug('get', $ckey, $data);
}
}
if ($data !== false) {
$md5sum = md5($data);
$data = $this->unserialize($data);
if ($nostore) {
return $data;
}
$this->cache_sums[$key] = $md5sum;
$this->cache[$key] = $data;
} else {
$this->cache[$key] = null;
}
} else {
$sql_result = $this->db->query("SELECT `data`, `cache_key` FROM {$this->table}" . " WHERE `cache_key` = ?", $this->prefix . '.' . $key);
if ($sql_arr = $this->db->fetch_assoc($sql_result)) {
if (strlen($sql_arr['data']) > 0) {
$md5sum = md5($sql_arr['data']);
$data = $this->unserialize($sql_arr['data']);
}
$this->db->reset();
if ($nostore) {
return $data;
}
$this->cache[$key] = $data;
$this->cache_sums[$key] = $md5sum;
} else {
$this->cache[$key] = null;
}
}
return $this->cache[$key];
}
示例2: array
/**
* Returns list of messages (headers). See rcube_imap::fetch_headers().
*
* @param string $mailbox Folder name
* @param array $msgs Message UIDs
*
* @return array The list of messages (rcube_message_header) indexed by UID
*/
function get_messages($mailbox, $msgs = array())
{
if (empty($msgs)) {
return array();
}
$result = array();
if ($this->mode & self::MODE_MESSAGE) {
// Fetch messages from cache
$sql_result = $this->db->query("SELECT `uid`, `data`, `flags`" . " FROM {$this->messages_table}" . " WHERE `user_id` = ?" . " AND `mailbox` = ?" . " AND `uid` IN (" . $this->db->array2list($msgs, 'integer') . ")", $this->userid, $mailbox);
$msgs = array_flip($msgs);
while ($sql_arr = $this->db->fetch_assoc($sql_result)) {
$uid = intval($sql_arr['uid']);
$result[$uid] = $this->build_message($sql_arr);
if (!empty($result[$uid])) {
// save memory, we don't need message body here (?)
$result[$uid]->body = null;
unset($msgs[$uid]);
}
}
$this->db->reset();
$msgs = array_flip($msgs);
}
// Fetch not found messages from IMAP server
if (!empty($msgs)) {
$messages = $this->imap->fetch_headers($mailbox, $msgs, false, true);
// Insert to DB and add to result list
if (!empty($messages)) {
foreach ($messages as $msg) {
if ($this->mode & self::MODE_MESSAGE) {
$this->add_message($mailbox, $msg, !array_key_exists($msg->uid, $result));
}
$result[$msg->uid] = $msg;
}
}
}
return $result;
}