Skip to content

Commit a2b7597

Browse files
author
Freek van Zee
committed
Remove Task.Run and return Task.FromResult(0)
1 parent 9adf5f4 commit a2b7597

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/WebApi.OutputCache.Core/Cache/MemoryCacheDefault.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static void Add(string key, object o, DateTimeOffset expiration, string
5454
{
5555
Cache.Add(key, o, cachePolicy);
5656
}
57-
}
57+
}
5858

5959
public virtual Task<IEnumerable<string>> AllKeysAsync
6060
{
@@ -66,7 +66,8 @@ public virtual Task<IEnumerable<string>> AllKeysAsync
6666

6767
public virtual Task RemoveStartsWithAsync(string key)
6868
{
69-
return Task.Run(() => RemoveStartsWith(key));
69+
RemoveStartsWith(key);
70+
return Task.FromResult(0);
7071
}
7172

7273
public virtual Task<T> GetAsync<T>(string key) where T : class
@@ -76,7 +77,8 @@ public virtual Task<T> GetAsync<T>(string key) where T : class
7677

7778
public virtual Task RemoveAsync(string key)
7879
{
79-
return Task.Run(() => Remove(key));
80+
Remove(key);
81+
return Task.FromResult(0);
8082
}
8183

8284
public virtual Task<bool> ContainsAsync(string key)
@@ -86,7 +88,8 @@ public virtual Task<bool> ContainsAsync(string key)
8688

8789
public virtual Task AddAsync(string key, object value, DateTimeOffset expiration, string dependsOnKey = null)
8890
{
89-
return Task.Run(() => Add(key, value, expiration, dependsOnKey));
91+
Add(key, value, expiration, dependsOnKey);
92+
return Task.FromResult(0);
9093
}
9194
}
9295
}

0 commit comments

Comments
 (0)