mirror of https://github.com/pixelfed/pixelfed.git
Update StatusHashtagService, remove problemaatic cache layer
This commit is contained in:
parent
33a60e767d
commit
e5401f8558
|
@ -84,18 +84,14 @@ class StatusHashtagService {
|
||||||
|
|
||||||
public static function statusTags($statusId)
|
public static function statusTags($statusId)
|
||||||
{
|
{
|
||||||
$key = 'pf:services:sh:id:' . $statusId;
|
$status = Status::with('hashtags')->find($statusId);
|
||||||
|
if(!$status) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return Cache::remember($key, 604800, function() use($statusId) {
|
$fractal = new Fractal\Manager();
|
||||||
$status = Status::find($statusId);
|
$fractal->setSerializer(new ArraySerializer());
|
||||||
if(!$status) {
|
$resource = new Fractal\Resource\Collection($status->hashtags, new HashtagTransformer());
|
||||||
return [];
|
return $fractal->createData($resource)->toArray();
|
||||||
}
|
|
||||||
|
|
||||||
$fractal = new Fractal\Manager();
|
|
||||||
$fractal->setSerializer(new ArraySerializer());
|
|
||||||
$resource = new Fractal\Resource\Collection($status->hashtags, new HashtagTransformer());
|
|
||||||
return $fractal->createData($resource)->toArray();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue