cache popular tags
This commit is contained in:
parent
fc7eb0609e
commit
996183a2d3
1 changed files with 13 additions and 9 deletions
|
@ -283,16 +283,20 @@ class TagList implements Extension {
|
||||||
global $database;
|
global $database;
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$query = "
|
$tags = $database->cache->get("popular_tags");
|
||||||
SELECT tag, count
|
if(empty($tags)) {
|
||||||
FROM tags
|
$query = "
|
||||||
WHERE count > 0
|
SELECT tag, count
|
||||||
ORDER BY count DESC
|
FROM tags
|
||||||
LIMIT :tag_list_length
|
WHERE count > 0
|
||||||
";
|
ORDER BY count DESC
|
||||||
$args = array("tag_list_length"=>$config->get_int('tag_list_length'));
|
LIMIT :tag_list_length
|
||||||
|
";
|
||||||
|
$args = array("tag_list_length"=>$config->get_int('tag_list_length'));
|
||||||
|
|
||||||
$tags = $database->get_all($query, $args);
|
$tags = $database->get_all($query, $args);
|
||||||
|
$database->cache->set("popular_tags", $tags, 600);
|
||||||
|
}
|
||||||
if(count($tags) > 0) {
|
if(count($tags) > 0) {
|
||||||
$this->theme->display_popular_block($page, $tags);
|
$this->theme->display_popular_block($page, $tags);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue