diff --git a/webui/model/search/search.php b/webui/model/search/search.php index 9e8d91ff..e5a99286 100644 --- a/webui/model/search/search.php +++ b/webui/model/search/search.php @@ -439,8 +439,14 @@ class ModelSearchSearch extends Model { if(count($ids) == 0) return $messages; - $query = $this->db->query("SELECT `id`, `from`, `subject`, `piler_id`, `reference`, `size`, `spam`, `sent`, `arrived`, `attachments` FROM `" . TABLE_META . "` WHERE `id` IN ($q) $sortorder", $ids); + if(MEMCACHED_ENABLED) { + $cache_key = $this->make_cache_file_name($ids, 'meta'); + $memcache = Registry::get('memcache'); + $m = $memcache->get($cache_key); + if(isset($m['meta'])) { return unserialize($m['meta']); } + } + $query = $this->db->query("SELECT `id`, `from`, `subject`, `piler_id`, `reference`, `size`, `spam`, `sent`, `arrived`, `attachments` FROM `" . TABLE_META . "` WHERE `id` IN ($q) $sortorder", $ids); if(isset($query->rows)) { @@ -486,6 +492,10 @@ class ModelSearchSearch extends Model { } } + if(MEMCACHED_ENABLED) { + $memcache->add($cache_key, array('meta' => serialize($messages)), 0, MEMCACHED_TTL); + } + return $messages; }