Skip to content

Commit

Permalink
Fixed issue where an exception is raised if KEYS() finds no matches a…
Browse files Browse the repository at this point in the history
…nd returns null (#733)
  • Loading branch information
gmurt authored Mar 8, 2024
1 parent b9fcc04 commit ec5a804
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sources/MVCFramework.Controllers.CacheController.pas
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,17 @@ procedure TMVCCacheController.SetExposeCache(const AValue: Boolean);

procedure TMVCCacheController.DeleteCacheKey(const AKey: string = '');
var
AKeys: TArray<string>;
AKeys: TRedisArray;
ARedis: IRedisClient;
begin
ARedis := RedisClient;
if AKey <> '' then
begin
AKeys := ARedis.KEYS(AKey).ToArray;
ARedis.DEL(AKeys);
AKeys := ARedis.KEYS(AKey);
if AKeys.HasValue then
begin
ARedis.DEL(AKeys.ToArray);
end;
end
else
begin
Expand Down

0 comments on commit ec5a804

Please sign in to comment.