refactor(CacheExtensions): Umbenennung der GetOrCreate-Methoden in GetOrSet
This commit is contained in:
parent
1bc31fe0ee
commit
85c33eb0f8
@ -33,7 +33,7 @@ namespace EnvelopeGenerator.Application.Extensions
|
|||||||
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
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);
|
var value = cache.GetString(key);
|
||||||
if (value is null)
|
if (value is null)
|
||||||
@ -58,7 +58,7 @@ namespace EnvelopeGenerator.Application.Extensions
|
|||||||
return value;
|
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);
|
var value = await cache.GetStringAsync(key, token: token);
|
||||||
if(value is null)
|
if(value is null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user