fix: 🐛 replace cache remember forever by 24 hours cache
This commit is contained in:
parent
ecadc53170
commit
b59672f465
2 changed files with 5 additions and 5 deletions
|
|
@ -95,17 +95,17 @@ class Tenant extends BaseTenant implements TenantContract
|
|||
private static function resetCache(): void
|
||||
{
|
||||
Cache::forget('tenantsGlobal');
|
||||
self::setTenantsCached();
|
||||
self::getTenantsCached();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all tenants in cache.
|
||||
* Get all tenants in cache.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public static function setTenantsCached(): \Illuminate\Support\Collection
|
||||
public static function getTenantsCached(): \Illuminate\Support\Collection
|
||||
{
|
||||
return Cache::rememberForever('tenantsGlobal', function () {
|
||||
return Cache::remember('tenantsGlobal', 86400, function () {
|
||||
return Tenant::get();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ViewServiceProvider extends ServiceProvider
|
|||
}
|
||||
}
|
||||
if (Schema::hasTable('tenants')) {
|
||||
View::share('tenantsGlobal', Tenant::setTenantsCached());
|
||||
View::share('tenantsGlobal', Tenant::getTenantsCached());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue