mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 00:01:21 +00:00
@@ -8,8 +8,6 @@ use App\Models\UserMovie;
|
||||
use App\Models\UserSerie;
|
||||
use Blacklight\NZB;
|
||||
use Blacklight\Releases;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -30,10 +28,7 @@ class RSS extends ApiController
|
||||
$this->releases = new Releases;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Release[]|Collection|mixed
|
||||
*/
|
||||
public function getRss($cat, $videosId, $aniDbID, int $userID = 0, int $airDate = -1, int $limit = 100, int $offset = 0)
|
||||
public function getRss($cat, $videosId, $aniDbID, int $userID = 0, int $airDate = -1, int $limit = 100, int $offset = 0): mixed
|
||||
{
|
||||
$catSearch = $cartSearch = '';
|
||||
$catLimit = 'AND r.categories_id BETWEEN '.Category::TV_ROOT.' AND '.Category::TV_OTHER;
|
||||
@@ -86,22 +81,12 @@ class RSS extends ApiController
|
||||
$limit === -1 ? '' : ' LIMIT '.$limit.' OFFSET '.$offset
|
||||
);
|
||||
|
||||
$expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium'));
|
||||
$result = Cache::get(md5($sql));
|
||||
if ($result !== null) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = Release::fromQuery($sql);
|
||||
Cache::put(md5($sql), $result, $expiresAt);
|
||||
|
||||
return $result;
|
||||
return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) {
|
||||
return Release::fromQuery($sql);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder|Collection
|
||||
*/
|
||||
public function getShowsRss(int $limit, int $userID = 0, array $excludedCats = [], int $airDate = -1)
|
||||
public function getShowsRss(int $limit, int $userID = 0, array $excludedCats = [], int $airDate = -1): mixed
|
||||
{
|
||||
$sql = sprintf(
|
||||
"
|
||||
@@ -140,22 +125,12 @@ class RSS extends ApiController
|
||||
! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', $limit > 100 ? 100 : $limit) : ''
|
||||
);
|
||||
|
||||
$expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium'));
|
||||
$result = Cache::get(md5($sql));
|
||||
if ($result !== null) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = Release::fromQuery($sql);
|
||||
Cache::put(md5($sql), $result, $expiresAt);
|
||||
|
||||
return $result;
|
||||
return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) {
|
||||
return Release::fromQuery($sql);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Release[]|Collection|mixed
|
||||
*/
|
||||
public function getMyMoviesRss(int $limit, int $userID = 0, array $excludedCats = [])
|
||||
public function getMyMoviesRss(int $limit, int $userID = 0, array $excludedCats = []): mixed
|
||||
{
|
||||
$sql = sprintf(
|
||||
"
|
||||
@@ -192,17 +167,9 @@ class RSS extends ApiController
|
||||
! empty($limit) ? sprintf(' LIMIT %d OFFSET 0', $limit > 100 ? 100 : $limit) : ''
|
||||
);
|
||||
|
||||
$expiresAt = now()->addMinutes(config('nntmux.cache_expiry_medium'));
|
||||
$result = Cache::get(md5($sql));
|
||||
if ($result !== null) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = Release::fromQuery($sql);
|
||||
|
||||
Cache::put(md5($sql), $result, $expiresAt);
|
||||
|
||||
return $result;
|
||||
return Cache::flexible(md5($sql), [config('nntmux.cache_expiry_medium'), config('nntmux.cache_expiry_long')], function () use ($sql) {
|
||||
return Release::fromQuery($sql);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user