removed overuse of cache:clear command

This commit is contained in:
denisdulici
2020-05-20 21:14:49 +03:00
parent b4c56ea617
commit 108c5522ac
16 changed files with 102 additions and 111 deletions

View File

@@ -4,8 +4,8 @@ namespace Akaunting\Module\Commands;
use App\Models\Module\Module;
use App\Models\Module\ModuleHistory;
use Artisan;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputArgument;
@@ -62,7 +62,9 @@ class DeleteCommand extends Command
// Trigger event
event(new \App\Events\Module\Deleted($alias, $company_id));
Artisan::call('cache:clear');
if (config('module.cache.enabled')) {
Cache::forget(config('module.cache.key'));
}
$this->info("Module [{$alias}] deleted.");
}

View File

@@ -6,6 +6,7 @@ use App\Models\Module\Module;
use App\Models\Module\ModuleHistory;
use App\Traits\Permissions;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputArgument;
@@ -60,7 +61,9 @@ class InstallCommand extends Command
'description' => trans('modules.installed', ['module' => $alias]),
]);
$this->call('cache:clear');
if (config('module.cache.enabled')) {
Cache::forget(config('module.cache.key'));
}
// Disable model cache during installation
config(['laravel-model-caching.enabled' => false]);