Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Caching for faster response time. #2859

Merged
merged 6 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add cache clear on WebAuthn operations
ildyria committed Feb 2, 2025
commit 3f45d6e7ec76b1c3557cd5e53a19571952ba938e
6 changes: 6 additions & 0 deletions app/Http/Controllers/WebAuthn/WebAuthnManageController.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@

namespace App\Http\Controllers\WebAuthn;

use App\Enum\CacheTag;
use App\Events\TaggedRouteCacheUpdated;
use App\Exceptions\UnauthenticatedException;
use App\Http\Requests\WebAuthn\DeleteCredentialRequest;
use App\Http\Requests\WebAuthn\EditCredentialRequest;
@@ -47,6 +49,8 @@ public function delete(DeleteCredentialRequest $request): void
$user = Auth::user() ?? throw new UnauthenticatedException();

$user->webAuthnCredentials()->where('id', $request->getId())->delete();

TaggedRouteCacheUpdated::dispatch(CacheTag::USER);
}

/**
@@ -61,5 +65,7 @@ public function edit(EditCredentialRequest $request): void
$credential = $request->getCredential();
$credential->alias = $request->getAlias();
$credential->save();

TaggedRouteCacheUpdated::dispatch(CacheTag::USER);
}
}
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@

namespace App\Http\Controllers\WebAuthn;

use App\Enum\CacheTag;
use App\Events\TaggedRouteCacheUpdated;
use App\Exceptions\UnauthenticatedException;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Routing\Controller;
@@ -46,5 +48,7 @@ public function register(AttestedRequest $request): void
/** @disregard P1014 */
$request->user = Auth::user() ?? throw new UnauthenticatedException();
$request->save();

TaggedRouteCacheUpdated::dispatch(CacheTag::USER);
}
}