Fix variable name conflict and change cache logs to DEBUG level

- Fixed CS0136 error: renamed 'doc' to 'extDoc' in AdminController to avoid variable name conflict
- Changed all Redis cache logs (HIT/MISS/SET) to DEBUG level instead of suppressing
- This allows cache logs to be visible in docker logs but not as noisy at INFO level
This commit is contained in:
2026-02-05 09:59:28 -05:00
parent 2e1577eb5a
commit e91833ebbb
2 changed files with 10 additions and 33 deletions

View File

@@ -537,18 +537,18 @@ public class AdminController : ControllerBase
{
try
{
using var doc = JsonDocument.Parse(externalMappingJson);
var root = doc.RootElement;
using var extDoc = JsonDocument.Parse(externalMappingJson);
var extRoot = extDoc.RootElement;
string? provider = null;
string? externalId = null;
if (root.TryGetProperty("provider", out var providerEl))
if (extRoot.TryGetProperty("provider", out var providerEl))
{
provider = providerEl.GetString();
}
if (root.TryGetProperty("id", out var idEl))
if (extRoot.TryGetProperty("id", out var idEl))
{
externalId = idEl.GetString();
}
@@ -674,12 +674,12 @@ public class AdminController : ControllerBase
{
try
{
using var doc = JsonDocument.Parse(externalMappingJson);
var root = doc.RootElement;
using var extDoc = JsonDocument.Parse(externalMappingJson);
var extRoot = extDoc.RootElement;
string? provider = null;
if (root.TryGetProperty("provider", out var providerEl))
if (extRoot.TryGetProperty("provider", out var providerEl))
{
provider = providerEl.GetString();
}

View File

@@ -58,27 +58,13 @@ public class RedisCacheService
{
var value = await _db!.StringGetAsync(key);
// Only log manual/external mapping HITs (not MISSes - they're expected)
var isManualMapping = key.Contains(":manual-map:") || key.Contains(":external-map:");
if (value.HasValue)
{
if (isManualMapping)
{
_logger.LogInformation("Redis cache HIT: {Key}", key);
}
else
{
_logger.LogDebug("Redis cache HIT: {Key}", key);
}
_logger.LogDebug("Redis cache HIT: {Key}", key);
}
else
{
// Don't log MISS for manual/external mappings - they're expected to be missing most of the time
if (!isManualMapping)
{
_logger.LogDebug("Redis cache MISS: {Key}", key);
}
_logger.LogDebug("Redis cache MISS: {Key}", key);
}
return value;
}
@@ -120,16 +106,7 @@ public class RedisCacheService
var result = await _db!.StringSetAsync(key, value, expiry);
if (result)
{
// Log manual/external mappings at INFO level, others at DEBUG
var isManualMapping = key.Contains(":manual-map:") || key.Contains(":external-map:");
if (isManualMapping)
{
_logger.LogInformation("Redis cache SET: {Key} (TTL: {Expiry})", key, expiry?.ToString() ?? "none");
}
else
{
_logger.LogDebug("Redis cache SET: {Key} (TTL: {Expiry})", key, expiry?.ToString() ?? "none");
}
_logger.LogDebug("Redis cache SET: {Key} (TTL: {Expiry})", key, expiry?.ToString() ?? "none");
}
return result;
}