refactor(CacheExtensions): Umbenennung der GetOrCreate-Methoden in GetOrSet
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user