added persistent cache for some slow queries in feed notification (even if not important to be fast on RSS feed, it might slow down galleries that are very large and actively used)

git-svn-id: http://piwigo.org/svn/trunk@28560 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices
2014-05-29 05:27:57 +00:00
parent 8aaa3612eb
commit 867d779ffc
+7 -1
View File
@@ -441,8 +441,13 @@ function news($start=null, $end=null, $exclude_img_cats=false, $add_url=false)
*/
function get_recent_post_dates($max_dates, $max_elements, $max_cats)
{
global $conf, $user;
global $conf, $user, $persistent_cache;
$cache_key = $persistent_cache->make_key('recent_posts'.$user['id'].$user['cache_update_time'].$max_dates.$max_elements.$max_cats);
if ($persistent_cache->get($cache_key, $cached))
{
return $cached;
}
$where_sql = get_std_sql_where_restrict_filter('WHERE', 'i.id', true);
$query = '
@@ -493,6 +498,7 @@ SELECT
}
}
$persistent_cache->set($cache_key, $dates);
return $dates;
}