refactor(CacheExtensions): Umbenennung der GetOrCreate-Methoden in GetOrSet

This commit is contained in:
Developer 02 2024-12-09 17:18:24 +01:00
parent 1bc31fe0ee
commit 85c33eb0f8

View File

@ -33,7 +33,7 @@ namespace EnvelopeGenerator.Application.Extensions
return value is null ? null : new(BitConverter.ToInt64(value, 0));
}
public static string GetOrCreate(this IDistributedCache cache, string key, Func<string> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken token = default)
public static string GetOrSet(this IDistributedCache cache, string key, Func<string> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken token = default)
{
var value = cache.GetString(key);
if (value is null)
@ -58,7 +58,7 @@ namespace EnvelopeGenerator.Application.Extensions
return value;
}
public static async Task<string> GetOrCreateAsync(this IDistributedCache cache, string key, Func<Task<string>> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken token = default)
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<string>> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken token = default)
{
var value = await cache.GetStringAsync(key, token: token);
if(value is null)