Add debug logging for Redis cache hits/misses

Now logs when cache entries are retrieved (HIT/MISS) and when they're stored
This commit is contained in:
2026-01-30 02:17:45 -05:00
parent 2bb754b245
commit 489159b424

View File

@@ -56,7 +56,16 @@ public class RedisCacheService
try try
{ {
return await _db!.StringGetAsync(key); var value = await _db!.StringGetAsync(key);
if (value.HasValue)
{
_logger.LogDebug("Redis cache HIT: {Key}", key);
}
else
{
_logger.LogDebug("Redis cache MISS: {Key}", key);
}
return value;
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -93,7 +102,12 @@ public class RedisCacheService
try try
{ {
return await _db!.StringSetAsync(key, value, expiry); var result = await _db!.StringSetAsync(key, value, expiry);
if (result)
{
_logger.LogDebug("Redis cache SET: {Key} (TTL: {Expiry})", key, expiry?.ToString() ?? "none");
}
return result;
} }
catch (Exception ex) catch (Exception ex)
{ {