Cache our echo and file area stats for page rendering performance reasons
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 35s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m49s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2024-10-24 17:00:14 +11:00
parent 4b309871ec
commit 179233385b

View File

@ -88,6 +88,7 @@ class Domain extends Model
public function echoarea_stats(): Collection
{
return Cache::remember(md5(sprintf('%d-%s',$this->id,__METHOD__)),self::CACHE_TIME,function() {
$dt = Carbon::now()->startOfday();
$case = CaseBuilder::whenRaw("datetime >= '?'",$dt->subDay()->format('Y-m-d'))->thenRaw("'day'")
->whenRaw("datetime >= '?'",$dt->subDays(7)->format('Y-m-d'))->thenRaw("'week'")
@ -104,6 +105,7 @@ class Domain extends Model
->orderBy('echoareas.name')
->orderBy('last_message','DESC')
->get();
});
}
public function echoarea_total_daily(Collection $systems=NULL): Collection
@ -126,6 +128,7 @@ class Domain extends Model
public function filearea_stats()
{
return Cache::remember(md5(sprintf('%d-%s',$this->id,__METHOD__)),self::CACHE_TIME,function() {
$dt = Carbon::now()->startOfday();
$case = CaseBuilder::whenRaw("datetime >= '?'",$dt->subDays(7)->format('Y-m-d'))->thenRaw("'week'")
->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'")
@ -141,6 +144,7 @@ class Domain extends Model
->orderBy('fileareas.name')
->orderBy('last_file','DESC')
->get();
});
}
/**