auditionadmin/app/Services/RoomAndJudgeCacheService.php

34 lines
627 B
PHP

<?php
namespace App\Services;
use App\Models\Audition;
use App\Models\Room;
use App\Models\ScoringGuide;
use Illuminate\Support\Facades\Cache;
class RoomAndJudgeCacheService
{
protected $cacheKey = 'roomJudge';
/**
* Create a new class instance.
*/
public function __construct()
{
//
}
public function getAuditions()
{
return Cache::rememberForever($this->cacheKey, function () {
return Room::with(['judges'])->get();
});
}
public function refreshCache()
{
Cache::forget($this->cacheKey);
$this->getAuditions();
}
}