mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
597 B
PHTML
30 lines
597 B
PHTML
3 years ago
|
<?php
|
||
|
|
||
|
namespace App\Services;
|
||
|
|
||
|
use Illuminate\Support\Facades\Redis;
|
||
|
|
||
|
class ReblogService
|
||
|
{
|
||
|
const CACHE_KEY = 'pf:services:reblogs:';
|
||
|
|
||
|
public static function get($profileId, $statusId)
|
||
|
{
|
||
|
if (!Redis::zcard(self::CACHE_KEY . $profileId)) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return Redis::zscore(self::CACHE_KEY . $profileId, $statusId) != null;
|
||
|
}
|
||
|
|
||
|
public static function add($profileId, $statusId)
|
||
|
{
|
||
|
return Redis::zadd(self::CACHE_KEY . $profileId, $statusId, $statusId);
|
||
|
}
|
||
|
|
||
|
public static function del($profileId, $statusId)
|
||
|
{
|
||
|
return Redis::zrem(self::CACHE_KEY . $profileId, $statusId);
|
||
|
}
|
||
|
}
|