mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-26 14:58:00 +01:00
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:
parent
27a4372fb8
commit
392f9ffd69
3 changed files with 3 additions and 3 deletions
|
@ -109,7 +109,7 @@ class StatsController extends ApiControllerBase
|
||||||
|
|
||||||
public function getTrackStats($id)
|
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 {
|
try {
|
||||||
$track = Track::published()->findOrFail($id);
|
$track = Track::published()->findOrFail($id);
|
||||||
} catch (ModelNotFoundException $e) {
|
} catch (ModelNotFoundException $e) {
|
||||||
|
|
|
@ -387,7 +387,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
||||||
{
|
{
|
||||||
$trackData = Cache::remember(
|
$trackData = Cache::remember(
|
||||||
'popular_tracks'.$count.'-'.($allowExplicit ? 'explicit' : 'safe'),
|
'popular_tracks'.$count.'-'.($allowExplicit ? 'explicit' : 'safe'),
|
||||||
5,
|
300,
|
||||||
function () use ($allowExplicit, $count, $skip) {
|
function () use ($allowExplicit, $count, $skip) {
|
||||||
/*$query = static
|
/*$query = static
|
||||||
::published()
|
::published()
|
||||||
|
|
|
@ -170,7 +170,7 @@ trait TrackCollection
|
||||||
return 0;
|
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;
|
$size = 0;
|
||||||
|
|
||||||
// Check whether the format is lossless yet not all master files are lossless
|
// Check whether the format is lossless yet not all master files are lossless
|
||||||
|
|
Loading…
Reference in a new issue