/**
  * 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 " . $this->db->table_name('cache_messages') . " WHERE changed < " . $this->db->fromunixtime($ts));
     $this->db->query("DELETE FROM " . $this->db->table_name('cache_index') . " WHERE changed < " . $this->db->fromunixtime($ts));
     $this->db->query("DELETE FROM " . $this->db->table_name('cache_thread') . " WHERE changed < " . $this->db->fromunixtime($ts));
 }
 /**
  * Getter for IMAP cache object
  */
 protected function get_cache_engine()
 {
     if ($this->caching && !$this->cache) {
         $rcmail = rcmail::get_instance();
         $ttl = $rcmail->config->get('message_cache_lifetime', '10d');
         $ttl = get_offset_time($ttl) - time();
         $this->cache = $rcmail->get_cache('IMAP', $this->caching, $ttl);
     }
     return $this->cache;
 }