| 12345678910111213141516171819202122 |
- using Application.Abstractions.Cache;
- using Application.Abstractions.Messaging;
- using SharedKernel.Results;
- namespace Application.Features.Admin.Cache.ClearCache;
- internal sealed class Handler(ICacheService cache) : ICommandHandler<Command, Result>
- {
- public async Task<Result> Handle(Command request, CancellationToken ct)
- {
- if (string.IsNullOrEmpty(request.Prefix))
- {
- await cache.RemoveByPrefixAsync("", ct);
- }
- else
- {
- await cache.RemoveByPrefixAsync(request.Prefix, ct);
- }
- return Result.Success();
- }
- }
|