1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-16 17:15:40 -05:00

Rename the variable name

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
This commit is contained in:
Cy Okeke 2025-03-12 15:02:49 +01:00
parent f1dde5bab1
commit bde722b604
No known key found for this signature in database
GPG Key ID: 88B341B55C84B45C

View File

@ -12,7 +12,7 @@ public class PhishingDomainRepository : IPhishingDomainRepository
{ {
private readonly string _connectionString; private readonly string _connectionString;
private readonly IDistributedCache _cache; private readonly IDistributedCache _cache;
private const string CacheKey = "PhishingDomains"; private const string _cacheKey = "PhishingDomains";
private static readonly DistributedCacheEntryOptions _cacheOptions = new DistributedCacheEntryOptions private static readonly DistributedCacheEntryOptions _cacheOptions = new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(24) // Cache for 24 hours AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(24) // Cache for 24 hours
@ -31,7 +31,7 @@ public class PhishingDomainRepository : IPhishingDomainRepository
public async Task<ICollection<string>> GetActivePhishingDomainsAsync() public async Task<ICollection<string>> GetActivePhishingDomainsAsync()
{ {
// Try to get from cache first // Try to get from cache first
var cachedDomains = await _cache.GetStringAsync(CacheKey); var cachedDomains = await _cache.GetStringAsync(_cacheKey);
if (!string.IsNullOrEmpty(cachedDomains)) if (!string.IsNullOrEmpty(cachedDomains))
{ {
return JsonSerializer.Deserialize<ICollection<string>>(cachedDomains) ?? new List<string>(); return JsonSerializer.Deserialize<ICollection<string>>(cachedDomains) ?? new List<string>();
@ -48,7 +48,7 @@ public class PhishingDomainRepository : IPhishingDomainRepository
// Store in cache // Store in cache
await _cache.SetStringAsync( await _cache.SetStringAsync(
CacheKey, _cacheKey,
JsonSerializer.Serialize(domains), JsonSerializer.Serialize(domains),
_cacheOptions); _cacheOptions);
@ -81,7 +81,7 @@ public class PhishingDomainRepository : IPhishingDomainRepository
// Update cache with new domains // Update cache with new domains
await _cache.SetStringAsync( await _cache.SetStringAsync(
CacheKey, _cacheKey,
JsonSerializer.Serialize(domains), JsonSerializer.Serialize(domains),
_cacheOptions); _cacheOptions);
} }