caching for related tags

This commit is contained in:
Shish 2012-05-16 06:33:04 +01:00
parent 4cbd00c039
commit 708b117b2a

View file

@ -394,6 +394,9 @@ class TagList extends Extension {
global $database; global $database;
global $config; global $config;
$related_tags = $database->cache->get("related_tags:$search");
if(empty($related_tags)) {
$wild_tags = Tag::explode($search); $wild_tags = Tag::explode($search);
// $search_tags = array(); // $search_tags = array();
@ -431,11 +434,14 @@ class TagList extends Extension {
$args = array("limit"=>$config->get_int('tag_list_length')); $args = array("limit"=>$config->get_int('tag_list_length'));
$related_tags = $database->get_all($query, $args); $related_tags = $database->get_all($query, $args);
$database->cache->set("related_tags:$search", $related_tags, 60*60);
}
}
if(count($related_tags) > 0) { if(count($related_tags) > 0) {
$this->theme->display_refine_block($page, $related_tags, $wild_tags); $this->theme->display_refine_block($page, $related_tags, $wild_tags);
} }
} }
}
// }}} // }}}
} }
?> ?>