mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
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:
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user