mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update HashtagFollowService, fix cache invalidation bug
This commit is contained in:
parent
d8fbb4ff32
commit
84f4e88573
1 changed files with 2 additions and 7 deletions
|
@ -24,12 +24,7 @@ class HashtagFollowService
|
||||||
|
|
||||||
public static function unfollow($hid, $pid)
|
public static function unfollow($hid, $pid)
|
||||||
{
|
{
|
||||||
$list = self::getPidByHid($hid);
|
return Redis::zrem(self::CACHE_KEY . $hid, $pid);
|
||||||
if($list && count($list)) {
|
|
||||||
$list = array_values(array_diff($list, [$pid]));
|
|
||||||
Cache::put(self::FOLLOW_KEY . $hid, $list, 86400);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function add($hid, $pid)
|
public static function add($hid, $pid)
|
||||||
|
@ -67,7 +62,7 @@ class HashtagFollowService
|
||||||
|
|
||||||
public static function isWarm($hid)
|
public static function isWarm($hid)
|
||||||
{
|
{
|
||||||
return Redis::zcount($hid, 0, -1) ?? Redis::zscore(self::CACHE_WARMED, $hid) != null;
|
return Redis::zcount(self::CACHE_KEY . $hid, 0, -1) ?? Redis::zscore(self::CACHE_WARMED, $hid) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setWarm($hid)
|
public static function setWarm($hid)
|
||||||
|
|
Loading…
Reference in a new issue