using System.Collections.Concurrent;
namespace learun.database
{
///
/// 版 本 EasyCode EC管理后台
/// Copyright (c) 2019-present EC管理有限公司
/// 创建人:tobin
/// 日 期:2019.09.10
/// 描 述:扩展数据库信息缓存
///
public class DbCaChe
{
///
/// 扩展数据库缓存
///
private static readonly ConcurrentDictionary _dblist =
new ConcurrentDictionary();
///
/// 设置
///
/// 键
/// 值
public static void SetValue(string key, DbModel value)
{
_dblist.GetOrAdd(key, value);
}
///
/// 获取
///
/// 键值
///
public static DbModel GetValue(string key)
{
_dblist.TryGetValue(key, out DbModel result);
return result;
}
///
/// 移除
///
/// 键值
///
public static DbModel RemoveValue(string key)
{
_dblist.TryGetValue(key, out DbModel result);
return result;
}
}
}