Skip to content

Commit 351a2c0

Browse files
committed
Update MemoryCacheDefault.cs
use virtual members
1 parent d70c016 commit 351a2c0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,40 @@ public class MemoryCacheDefault : IApiOutputCache
99
{
1010
private static readonly MemoryCache Cache = MemoryCache.Default;
1111

12-
public void RemoveStartsWith(string key)
12+
public virtual void RemoveStartsWith(string key)
1313
{
1414
lock (Cache)
1515
{
1616
Cache.Remove(key);
1717
}
1818
}
1919

20-
public T Get<T>(string key) where T : class
20+
public virtual T Get<T>(string key) where T : class
2121
{
2222
var o = Cache.Get(key) as T;
2323
return o;
2424
}
2525

2626
[Obsolete("Use Get<T> instead")]
27-
public object Get(string key)
27+
public virtual object Get(string key)
2828
{
2929
return Cache.Get(key);
3030
}
3131

32-
public void Remove(string key)
32+
public virtual void Remove(string key)
3333
{
3434
lock (Cache)
3535
{
3636
Cache.Remove(key);
3737
}
3838
}
3939

40-
public bool Contains(string key)
40+
public virtual bool Contains(string key)
4141
{
4242
return Cache.Contains(key);
4343
}
4444

45-
public void Add(string key, object o, DateTimeOffset expiration, string dependsOnKey = null)
45+
public virtual void Add(string key, object o, DateTimeOffset expiration, string dependsOnKey = null)
4646
{
4747
var cachePolicy = new CacheItemPolicy
4848
{
@@ -61,12 +61,12 @@ public void Add(string key, object o, DateTimeOffset expiration, string dependsO
6161
}
6262
}
6363

64-
public IEnumerable<string> AllKeys
64+
public virtual IEnumerable<string> AllKeys
6565
{
6666
get
6767
{
6868
return Cache.Select(x => x.Key);
6969
}
7070
}
7171
}
72-
}
72+
}

0 commit comments

Comments
 (0)