mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 17:30:12 +01:00
added the queried metadata to memcache
This commit is contained in:
parent
1feb01384f
commit
3073665cfe
@ -439,8 +439,14 @@ class ModelSearchSearch extends Model {
|
|||||||
|
|
||||||
if(count($ids) == 0) return $messages;
|
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)) {
|
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;
|
return $messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user