Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx

This commit is contained in:
2025-01-25 04:23:40 -06:00
parent c3045b43b1
commit 64d505910f
1283 changed files with 140198 additions and 0 deletions

View File

@ -0,0 +1,63 @@
<?php
namespace Modules\Admin\App\Livewire\Cache;
use Livewire\Component;
use Modules\Admin\App\Services\CacheConfigService;
use Modules\Admin\App\Services\SessionManagerService;
class SessionStats extends Component
{
private $targetNotify = "#session-stats-card .notification-container";
public $cacheConfig = [];
public $sessionStats = [];
protected $listeners = ['reloadSessionStatsEvent' => 'reloadSessionStats'];
public function mount(CacheConfigService $cacheConfigService)
{
$this->cacheConfig = $cacheConfigService->getConfig();
$this->reloadSessionStats(false);
}
public function reloadSessionStats($notify = true)
{
$sessionManagerService = new SessionManagerService();
$this->sessionStats = $sessionManagerService->getSessionStats();
if ($notify) {
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $this->sessionStats['status'],
message: $this->sessionStats['message']
);
}
}
public function clearSessions()
{
$sessionManagerService = new SessionManagerService();
$message = $sessionManagerService->clearSessions();
$this->reloadSessionStats(false);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $message['status'],
message: $message['message'],
);
$this->dispatch('reloadRedisStatsEvent', notify: false);
$this->dispatch('reloadMemcachedStatsEvent', notify: false);
}
public function render()
{
return view('admin::livewire.cache.session-stats');
}
}