Shift Cache methods to use seconds

To conform with PSR-16 Laravel 5.8 changed the cache expiration time from minutes to seconds. If you were passing an integer, Shift converted this to its integer equivalent in seconds. If you were passing a "minutes" variable, Shift converted this to the relative date time equivalent for readability.
This commit is contained in:
Laravel Shift 2021-02-14 18:01:31 +00:00
parent 27a4372fb8
commit 392f9ffd69
3 changed files with 3 additions and 3 deletions

View file

@ -109,7 +109,7 @@ class StatsController extends ApiControllerBase
public function getTrackStats($id)
{
$cachedOutput = Cache::remember('track_stats'.$id, 5, function () use ($id) {
$cachedOutput = Cache::remember('track_stats'.$id, 300, function () use ($id) {
try {
$track = Track::published()->findOrFail($id);
} catch (ModelNotFoundException $e) {

View file

@ -387,7 +387,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
{
$trackData = Cache::remember(
'popular_tracks'.$count.'-'.($allowExplicit ? 'explicit' : 'safe'),
5,
300,
function () use ($allowExplicit, $count, $skip) {
/*$query = static
::published()

View file

@ -170,7 +170,7 @@ trait TrackCollection
return 0;
}
return Cache::remember($this->getCacheKey('filesize-'.$format), 1440, function () use ($tracks, $format) {
return Cache::remember($this->getCacheKey('filesize-'.$format), 86400, function () use ($tracks, $format) {
$size = 0;
// Check whether the format is lossless yet not all master files are lossless