Fixed issue where an exception is raised if KEYS() finds no matches and returns null (#733)

This commit is contained in:
Graham Murt 2024-03-08 14:26:35 +00:00 committed by GitHub
parent b9fcc04647
commit ec5a804576
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -265,14 +265,17 @@ end;
procedure TMVCCacheController.DeleteCacheKey(const AKey: string = ''); procedure TMVCCacheController.DeleteCacheKey(const AKey: string = '');
var var
AKeys: TArray<string>; AKeys: TRedisArray;
ARedis: IRedisClient; ARedis: IRedisClient;
begin begin
ARedis := RedisClient; ARedis := RedisClient;
if AKey <> '' then if AKey <> '' then
begin begin
AKeys := ARedis.KEYS(AKey).ToArray; AKeys := ARedis.KEYS(AKey);
ARedis.DEL(AKeys); if AKeys.HasValue then
begin
ARedis.DEL(AKeys.ToArray);
end;
end end
else else
begin begin