| | |
| | | $uid = intval($sql_arr['uid']); |
| | | $result[$uid] = $this->build_message($sql_arr); |
| | | |
| | | // save memory, we don't need message body here (?) |
| | | $result[$uid]->body = null; |
| | | |
| | | if (!empty($result[$uid])) { |
| | | // save memory, we don't need message body here (?) |
| | | $result[$uid]->body = null; |
| | | |
| | | unset($msgs[$uid]); |
| | | } |
| | | } |
| | |
| | | function get_message($mailbox, $uid, $update = true, $cache = true) |
| | | { |
| | | // Check internal cache |
| | | if (($message = $this->icache['message']) |
| | | && $message['mailbox'] == $mailbox && $message['object']->uid == $uid |
| | | if ($this->icache['message'] |
| | | && $this->icache['message']['mailbox'] == $mailbox |
| | | && $this->icache['message']['object']->uid == $uid |
| | | ) { |
| | | return $this->icache['message']['object']; |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Delete cache entries older than TTL |
| | | * |
| | | * @param string $ttl Lifetime of message cache entries |
| | | */ |
| | | function expunge($ttl) |
| | | { |
| | | // get expiration timestamp |
| | | $ts = get_offset_time($ttl, -1); |
| | | |
| | | $this->db->query("DELETE FROM ".get_table_name('cache_messages') |
| | | ." WHERE changed < " . $this->db->fromunixtime($ts)); |
| | | |
| | | $this->db->query("DELETE FROM ".get_table_name('cache_index') |
| | | ." WHERE changed < " . $this->db->fromunixtime($ts)); |
| | | |
| | | $this->db->query("DELETE FROM ".get_table_name('cache_thread') |
| | | ." WHERE changed < " . $this->db->fromunixtime($ts)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fetches index data from database |
| | | */ |
| | | private function get_index_row($mailbox) |