using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace YD_AllHeartRates.Commons.MemoryCaches
{
///
/// 实例化缓存接口ICaching
///
public class MemoryCaching : ICaching
{
private readonly IMemoryCache _cache;
///
/// 构造函数
///
///
public MemoryCaching(IMemoryCache cache)
{
_cache = cache;
}
public object Get(string cacheKey)
{
return _cache.Get(cacheKey);
}
public void Update(string cacheKey, object cacheValue)
{
_cache.Remove(cacheKey);
_cache.Set(cacheKey, cacheValue, TimeSpan.FromSeconds(3600));
}
public void Set(string cacheKey, object cacheValue)
{
_cache.Set(cacheKey, cacheValue, TimeSpan.FromSeconds(3600));
}
public bool Exists(string key)
{
throw new NotImplementedException();
}
public void LPush(string key, string val)
{
throw new NotImplementedException();
}
public void RPush(string key, string val)
{
throw new NotImplementedException();
}
public object ListDequeue(string key)
{
throw new NotImplementedException();
}
public T ListDequeue(string key) where T : class
{
throw new NotImplementedException();
}
public void ListRemove(string key, int keepIndex)
{
throw new NotImplementedException();
}
public bool AddObject(string key, object value, int expireSeconds = -1, bool isSliding = false)
{
throw new NotImplementedException();
}
public bool Add(string key, string value, int expireSeconds = -1, bool isSliding = false)
{
throw new NotImplementedException();
}
public bool Remove(string key)
{
throw new NotImplementedException();
}
public void RemoveAll(IEnumerable keys)
{
throw new NotImplementedException();
}
public T Get(string key) where T : class
{
throw new NotImplementedException();
}
string ICaching.Get(string key)
{
throw new NotImplementedException();
}
}
}