Remove static cache from our_address in favour of Cache::class keyed off setup:system_id
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
use App\Models\{Address,Domain,Setup};
|
||||
|
||||
@@ -92,16 +93,15 @@ if (! function_exists('hexstr')) {
|
||||
*/
|
||||
function our_address(Domain|Address $o=NULL): Collection|Address|NULL
|
||||
{
|
||||
static $so = NULL;
|
||||
static $our = NULL;
|
||||
$so = Cache::remember('so',5,function() {
|
||||
return Setup::findOrFail(config('app.id'));
|
||||
});
|
||||
|
||||
if (! $so)
|
||||
$so = Setup::findOrFail(config('app.id'));
|
||||
|
||||
if (! $our) {
|
||||
$our = Cache::remember(sprintf('%d-akas',$so->system_id),60,function() use ($so) {
|
||||
$so->load(['system.akas.zone.domain']);
|
||||
$our = $so->system->akas;
|
||||
}
|
||||
|
||||
return $so->system->akas;
|
||||
});
|
||||
|
||||
// If we dont have any addresses
|
||||
if ($our->count() === 0)
|
||||
|
Reference in New Issue
Block a user