| | |
| | | private $db_header_fields = array('idx', 'uid', 'subject', 'from', 'to', 'cc', 'date', 'size'); |
| | | private $options = array('auth_method' => 'check'); |
| | | private $host, $user, $pass, $port, $ssl; |
| | | private $caching = false; |
| | | |
| | | /** |
| | | * All (additional) headers used (in any way) by Roundcube |
| | |
| | | function set_caching($type) |
| | | { |
| | | if ($type) { |
| | | $rcmail = rcmail::get_instance(); |
| | | $this->cache = $rcmail->get_cache('IMAP', $type); |
| | | $this->caching = true; |
| | | } |
| | | else { |
| | | if ($this->cache) |
| | | $this->cache->close(); |
| | | $this->cache = null; |
| | | $this->caching = false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Getter for IMAP cache object |
| | | */ |
| | | private function get_cache_engine() |
| | | { |
| | | if ($this->caching && !$this->cache) { |
| | | $rcmail = rcmail::get_instance(); |
| | | $this->cache = $rcmail->get_cache('IMAP', $type); |
| | | } |
| | | |
| | | return $this->cache; |
| | | } |
| | | |
| | | /** |
| | | * Returns cached value |
| | |
| | | */ |
| | | function get_cache($key) |
| | | { |
| | | if ($this->cache) { |
| | | return $this->cache->get($key); |
| | | if ($cache = $this->get_cache_engine()) { |
| | | return $cache->get($key); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | function update_cache($key, $data) |
| | | { |
| | | if ($this->cache) { |
| | | $this->cache->set($key, $data); |
| | | if ($cache = $this->get_cache_engine()) { |
| | | $cache->set($key, $data); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | function clear_cache($key=null, $prefix_mode=false) |
| | | { |
| | | if ($this->cache) { |
| | | $this->cache->remove($key, $prefix_mode); |
| | | if ($cache = $this->get_cache_engine()) { |
| | | $cache->remove($key, $prefix_mode); |
| | | } |
| | | } |
| | | |