Use period and limit in the cache key
This commit is contained in:
parent
f7cf8fe3d0
commit
3b90dc0289
|
@ -494,7 +494,7 @@ class Tag
|
||||||
*/
|
*/
|
||||||
public static function getGlobalTrendingHashtags(int $period, $limit = 10)
|
public static function getGlobalTrendingHashtags(int $period, $limit = 10)
|
||||||
{
|
{
|
||||||
$tags = DI::cache()->get('global_trending_tags');
|
$tags = DI::cache()->get('global_trending_tags-' . $period . '-' . $limit);
|
||||||
if (!empty($tags)) {
|
if (!empty($tags)) {
|
||||||
return $tags;
|
return $tags;
|
||||||
} else {
|
} else {
|
||||||
|
@ -520,7 +520,7 @@ class Tag
|
||||||
|
|
||||||
if (DBA::isResult($tagsStmt)) {
|
if (DBA::isResult($tagsStmt)) {
|
||||||
$tags = DBA::toArray($tagsStmt);
|
$tags = DBA::toArray($tagsStmt);
|
||||||
DI::cache()->set('global_trending_tags', $tags, Duration::HOUR);
|
DI::cache()->set('global_trending_tags-' . $period . '-' . $limit, $tags, Duration::HOUR);
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue