mirror of https://github.com/pixelfed/pixelfed
commit
a2c56c4e71
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Bookmark;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
|
||||
class BookmarkService
|
||||
{
|
||||
const CACHE_KEY = 'pf:services:bookmarks:';
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,2 +1,3 @@
|
||||
*
|
||||
!missing.png
|
||||
!.gitignore
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 81 B |
Loading…
Reference in New Issue