cache popular tags
This commit is contained in:
parent
fc7eb0609e
commit
996183a2d3
1 changed files with 13 additions and 9 deletions
|
@ -283,6 +283,8 @@ class TagList implements Extension {
|
||||||
global $database;
|
global $database;
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$tags = $database->cache->get("popular_tags");
|
||||||
|
if(empty($tags)) {
|
||||||
$query = "
|
$query = "
|
||||||
SELECT tag, count
|
SELECT tag, count
|
||||||
FROM tags
|
FROM tags
|
||||||
|
@ -293,6 +295,8 @@ class TagList implements Extension {
|
||||||
$args = array("tag_list_length"=>$config->get_int('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