mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +01:00
Updated doServicesCount func to be cached
Updated doServicesCount func to be cached
This commit is contained in:
parent
8e5a1f62c3
commit
025d206618
@ -19,6 +19,8 @@ class Home extends Model
|
||||
Cache::forget('due_soon');//Main page due_soon cache
|
||||
Cache::forget('recently_added');//Main page recently_added cache
|
||||
Cache::forget('all_pricing');//All the pricing
|
||||
Cache::forget('services_count_all');
|
||||
Cache::forget('pricing_breakdown');
|
||||
}
|
||||
|
||||
public static function servicesCount()
|
||||
@ -161,10 +163,10 @@ class Home extends Model
|
||||
|
||||
public static function doServicesCount($services_count): array
|
||||
{
|
||||
$servers_count = $domains_count = $shared_count = $reseller_count = $other_count = $seedbox_count = $total_services = 0;
|
||||
|
||||
$services_count = json_decode($services_count, true);
|
||||
|
||||
return Cache::remember('services_count_all', now()->addWeek(1), function () use ($services_count) {
|
||||
$servers_count = $domains_count = $shared_count = $reseller_count = $other_count = $seedbox_count = $total_services = 0;
|
||||
foreach ($services_count as $sc) {
|
||||
$total_services += $sc['amount'];
|
||||
if ($sc['service_type'] === 1) {
|
||||
@ -191,6 +193,8 @@ class Home extends Model
|
||||
'seedbox' => $seedbox_count,
|
||||
'total' => $total_services
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,6 +164,8 @@ class Server extends Model
|
||||
Cache::forget('servers_summary');//servers summary cache
|
||||
Cache::forget('public_server_data');//public servers
|
||||
Cache::forget('all_pricing');//All pricing
|
||||
Cache::forget('services_count_all');
|
||||
Cache::forget('pricing_breakdown');
|
||||
}
|
||||
|
||||
public static function serverSpecificCacheForget(string $server_id): void
|
||||
|
Loading…
Reference in New Issue
Block a user