mirror of https://github.com/abpframework/abp.git
3 changed files with 52 additions and 12 deletions
@ -0,0 +1,11 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Http.ProxyScripting |
|||
{ |
|||
public interface IProxyScriptManagerCache |
|||
{ |
|||
string GetOrAdd(string key, Func<string> factory); |
|||
|
|||
void Set(string key, string value); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Collections.Concurrent; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.Http.ProxyScripting |
|||
{ |
|||
public class ProxyScriptManagerCache : IProxyScriptManagerCache, ISingletonDependency |
|||
{ |
|||
private readonly ConcurrentDictionary<string, string> _cache; |
|||
|
|||
public ProxyScriptManagerCache() |
|||
{ |
|||
_cache = new ConcurrentDictionary<string, string>(); |
|||
} |
|||
|
|||
public string GetOrAdd(string key, Func<string> factory) |
|||
{ |
|||
return _cache.GetOrAdd(key, factory); |
|||
} |
|||
|
|||
public void Set(string key, string value) |
|||
{ |
|||
_cache[key] = value; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue