using System.Text.RegularExpressions;
using System.Threading.Tasks;
public static void Main()
private readonly IAppCache _cache;
_cache = new CachingService();
public async Task<string> Test(string val, int sleep = 0)
Console.WriteLine("{1} GetOrAddAsync {0}", val, DateTime.UtcNow.ToString("HH:mm:ss:fffffff"));
var a = await _cache.GetOrAddAsync("Key", async () => {
Console.WriteLine("{1} {0} before sleep ", val, DateTime.UtcNow.ToString("HH:mm:ss:fffffff"));
Console.WriteLine("{0} Addind value {1}", DateTime.UtcNow.ToString("HH:mm:ss:fffffff"), val);
Console.WriteLine("{2} Result from input {0}: {1}", val, a, DateTime.UtcNow.ToString("HH:mm:ss:fffffff"));