mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-08-04 12:27:57 +08:00
##591 added addanddelete method back to cache as Ocelot.Provider.Consul uses it...sigh at me (#592)
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Ocelot.Cache
|
||||
{
|
||||
public interface IOcelotCache<T>
|
||||
{
|
||||
void Add(string key, T value, TimeSpan ttl, string region);
|
||||
T Get(string key, string region);
|
||||
void ClearRegion(string region);
|
||||
}
|
||||
}
|
||||
using System;
|
||||
|
||||
namespace Ocelot.Cache
|
||||
{
|
||||
public interface IOcelotCache<T>
|
||||
{
|
||||
void Add(string key, T value, TimeSpan ttl, string region);
|
||||
T Get(string key, string region);
|
||||
void ClearRegion(string region);
|
||||
void AddAndDelete(string key, T value, TimeSpan ttl, string region);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAndDelete(string key, T value, TimeSpan ttl, string region)
|
||||
{
|
||||
if (_cache.ContainsKey(key))
|
||||
{
|
||||
_cache.Remove(key);
|
||||
}
|
||||
|
||||
Add(key, value, ttl, region);
|
||||
}
|
||||
|
||||
public void ClearRegion(string region)
|
||||
{
|
||||
if (_regions.ContainsKey(region))
|
||||
|
Reference in New Issue
Block a user