Skip to content

Commit 4e4979f

Browse files
committed
Merge pull request #175 from filipw/dev
Implement RemoveStartsWith with lock
2 parents b750f2e + 1129abc commit 4e4979f

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

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+
}

src/WebApi.OutputCache.V2/InvalidateCacheOutputAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public InvalidateCacheOutputAttribute(string methodName)
1717

1818
public InvalidateCacheOutputAttribute(string methodName, Type type = null)
1919
{
20-
_controller = type != null ? type.Name.Replace("Controller", string.Empty) : null;
20+
_controller = type != null ? type.FullName : null;
2121
_methodName = methodName;
2222
}
2323

0 commit comments

Comments
 (0)