auditionadmin/app/Services/ScoringGuideCacheService.php

32 lines
603 B
PHP

<?php
namespace App\Services;
use App\Models\ScoringGuide;
use Illuminate\Support\Facades\Cache;
class ScoringGuideCacheService
{
protected $cacheKey = 'scoring_guides';
/**
* Create a new class instance.
*/
public function __construct()
{
//
}
public function getScoringGuides()
{
return Cache::rememberForever($this->cacheKey, function () {
return ScoringGuide::with('subscores')->get();
});
}
public function refreshCache()
{
Cache::forget($this->cacheKey);
$this->getScoringGuides();
}
}