using EasyCaching.Core;
namespace SqlSugar;
///
/// SqlSugar ORM框架所需缓存配置
///
public class SqlSugarCache : ICacheService
{
private static readonly IEasyCachingProvider Cache = App.GetRequiredService();
public void Add(string key, V value)
{
Cache.Set(key, value, TimeSpan.MaxValue);
}
public void Add(string key, V value, int cacheDurationInSeconds)
{
Cache.Set(key, value, TimeSpan.FromSeconds(cacheDurationInSeconds));
}
public bool ContainsKey(string key)
{
return Cache.Exists(key);
}
public V Get(string key)
{
return Cache.Get(key).Value;
}
public IEnumerable GetAllKey()
{
return Cache.GetByPrefix