1
0
Fork 0

Update Services, use zpopmin on predis

This commit is contained in:
Daniel Supernault 2023-07-13 22:06:21 -06:00
parent 1cc6274ac0
commit 4b2c66f557
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
3 changed files with 3 additions and 9 deletions

View File

@ -24,9 +24,7 @@ class LikeService {
public static function setAdd($profileId, $statusId) public static function setAdd($profileId, $statusId)
{ {
if(self::setCount($profileId) > 400) { if(self::setCount($profileId) > 400) {
if(config('database.redis.client') === 'phpredis') { Redis::zpopmin(self::CACHE_SET_KEY . $profileId);
Redis::zpopmin(self::CACHE_SET_KEY . $profileId);
}
} }
return Redis::zadd(self::CACHE_SET_KEY . $profileId, $statusId, $statusId); return Redis::zadd(self::CACHE_SET_KEY . $profileId, $statusId, $statusId);

View File

@ -49,9 +49,7 @@ class NetworkTimelineService
public static function add($val) public static function add($val)
{ {
if(self::count() > config('instance.timeline.network.cache_dropoff')) { if(self::count() > config('instance.timeline.network.cache_dropoff')) {
if(config('database.redis.client') === 'phpredis') { Redis::zpopmin(self::CACHE_KEY);
Redis::zpopmin(self::CACHE_KEY);
}
} }
return Redis::zadd(self::CACHE_KEY, $val, $val); return Redis::zadd(self::CACHE_KEY, $val, $val);

View File

@ -49,9 +49,7 @@ class PublicTimelineService {
public static function add($val) public static function add($val)
{ {
if(self::count() > 400) { if(self::count() > 400) {
if(config('database.redis.client') === 'phpredis') { Redis::zpopmin(self::CACHE_KEY);
Redis::zpopmin(self::CACHE_KEY);
}
} }
return Redis::zadd(self::CACHE_KEY, $val, $val); return Redis::zadd(self::CACHE_KEY, $val, $val);