public Task GetOrAdd(string key, Func <Task> serviceMethod, Type taskResultType, string[] metricsKeys, IMethodCachingSettings settings) { var getValueTask = Task.Run(() => GetOrAdd(key, () => TaskConverter.ToWeaklyTypedTask(serviceMethod(), taskResultType), metricsKeys, settings)); return(TaskConverter.ToStronglyTypedTask(getValueTask, taskResultType)); }
public Task GetOrAdd(string key, Func <Task> factory, Type taskResultType, CacheItemPolicyEx policy, params string[] metricsKeys) { var getValueTask = GetOrAdd(key, () => TaskConverter.ToWeaklyTypedTask(factory(), taskResultType), policy, metricsKeys, taskResultType); return(TaskConverter.ToStronglyTypedTask(getValueTask, taskResultType)); }