Explorar el Código

gitignore配置修改vsidx

jiangjc hace 2 años
padre
commit
688754e72b

BIN
OASystem/.vs/OASystem/FileContentIndex/2ad7da1f-5b47-45da-b993-002b0e373a11.vsidx


BIN
OASystem/.vs/OASystem/FileContentIndex/4faf7178-56b5-4e87-88b0-b24bcf656ce3.vsidx


+ 0 - 764
OASystem/OASystem.Infrastructure/Tools/RedisHelper.cs

@@ -11,770 +11,6 @@ using System.Text;
 
 namespace OASystem.Infrastructure.Tools
 {
-    #region MyRegion
-    //**************操作记录******************
-    //内容描述:Redis帮助类
-    //***************************************
-    //public static class RedisHelper
-    //{
-
-    //    private static string _strConn = "132.232.92.186:6379";
-    //    private static string _strPwd = "";
-
-    //    private static int _strDb = -1;
-    //    static ConnectionMultiplexer _redis;
-    //    static readonly object _locker = new object();
-
-    //    #region 单例模式
-    //    public static ConnectionMultiplexer Manager
-    //    {
-
-    //        get
-    //        {
-    //            if (_redis == null)
-    //            {
-    //                lock (_locker)
-    //                {
-    //                    if (_redis != null) return _redis;
-    //                    _redis = GetManager();
-    //                    return _redis;
-    //                }
-    //            }
-    //            return _redis;
-    //        }
-    //    }
-
-    //    private static ConnectionMultiplexer GetManager(string connectionString = null)
-    //    {
-
-    //        if (string.IsNullOrEmpty(connectionString))
-    //        {
-    //            connectionString = _strConn;
-    //        }
-    //        var options = ConfigurationOptions.Parse(connectionString);
-    //        options.Password = _strPwd;
-    //        return ConnectionMultiplexer.Connect(options);
-    //    }
-    //    #endregion
-
-    //    #region 辅助方法
-    //    /// <summary>
-    //    /// 对象序列化成字符串
-    //    /// </summary>
-    //    /// <typeparam name="T">泛型对象</typeparam>
-    //    /// <param name="value"></param>
-    //    /// <returns></returns>
-    //    private static string ConvertJson<T>(T value)
-    //    {
-    //        string result = value is string ? value.ToString() : JsonConvert.SerializeObject(value);
-    //        return result;
-    //    }
-
-    //    /// <summary>
-    //    /// RedisValue序列化成对象
-    //    /// </summary>
-    //    /// <typeparam name="T">序列化后的对象</typeparam>
-    //    /// <param name="value">RedisValue</param>
-    //    /// <returns></returns>
-    //    private static T ConvertObj<T>(RedisValue value)
-    //    {
-    //        if (value.IsNull)
-    //        {
-    //            return default(T);
-    //        }
-    //        else
-    //        {
-    //            return JsonConvert.DeserializeObject<T>(value);
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 多个值序列化成list集合
-    //    /// </summary>
-    //    /// <typeparam name="T">集合对象</typeparam>
-    //    /// <param name="values">RedisValue</param>
-    //    /// <returns></returns>
-    //    private static List<T> ConvetList<T>(RedisValue[] values)
-    //    {
-    //        List<T> result = new List<T>();
-    //        foreach (var item in values)
-    //        {
-    //            var model = ConvertObj<T>(item);
-    //            if (model != null)
-    //                result.Add(model);
-    //        }
-    //        return result;
-    //    }
-
-    //    private static RedisKey[] ConvertRedisKeys(List<string> redisKeys, string prefix)
-    //    {
-    //        if (string.IsNullOrEmpty(prefix))
-    //        {
-    //            return redisKeys.Select(redisKey => (RedisKey)redisKey).ToArray();
-    //        }
-    //        else
-    //        {
-    //            return redisKeys.Select(redisKey => (RedisKey)(prefix + ":" + redisKey)).ToArray();
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 获取要操作的库
-    //    /// </summary>
-    //    /// <param name="db">库,0和-1都是第一个库,1是第二个库...</param>
-    //    /// <returns></returns>
-    //    private static int GetOperationDB(RedisEnum db)
-    //    {
-    //        if (db == RedisEnum.DB0)
-    //        {
-    //            return _strDb;
-    //        }
-    //        else
-    //        {
-    //            return (int)db;
-    //        }
-    //    }
-
-
-    //    /// <summary>
-    //    /// 获得枚举的Description
-    //    /// </summary>
-    //    /// <param name="value">枚举值</param>
-    //    /// <param name="nameInstead">当枚举值没有定义DescriptionAttribute,是否使用枚举名代替,默认是使用</param>
-    //    /// <returns>枚举的Description</returns>
-    //    private static string GetDescription(this Enum value, Boolean nameInstead = true)
-    //    {
-    //        Type type = value.GetType();
-    //        string name = Enum.GetName(type, value);
-    //        if (name == null)
-    //        {
-    //            return null;
-    //        }
-
-    //        FieldInfo field = type.GetField(name);
-    //        DescriptionAttribute attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
-
-    //        if (attribute == null && nameInstead == true)
-    //        {
-    //            return name;
-    //        }
-    //        return attribute == null ? null : attribute.Description;
-    //    }
-    //    #endregion
-
-    //    /// <summary>
-    //    /// 是否存在
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    public static bool KeyExists(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        try
-    //        {
-    //            string strFd = GetDescription(folder);
-    //            return Manager.GetDatabase(GetOperationDB(db)).KeyExists(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key);
-    //        }
-    //        catch (Exception)
-    //        {
-    //            return false;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 设置过期时间
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="min">过期时间,单位:分钟</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    public static bool KeyExpire(string key, int min = 600, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        try
-    //        {
-    //            string strFd = GetDescription(folder);
-    //            return Manager.GetDatabase(GetOperationDB(db)).KeyExpire(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, DateTime.Now.AddMinutes(min));
-    //        }
-    //        catch (Exception)
-    //        {
-    //            return false;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 修改键
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="newKey">新键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static bool KeyRename(string key, string newKey, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        try
-    //        {
-    //            string strFd = GetDescription(folder);
-    //            return Manager.GetDatabase(GetOperationDB(db)).KeyRename(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, string.IsNullOrEmpty(strFd) ? newKey : strFd + ":" + newKey);
-    //        }
-    //        catch (Exception)
-    //        {
-    //            return false;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 清空
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static IEnumerable<RedisKey> AllClear(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        return Manager.GetServer(_strConn, _strPwd).Keys(GetOperationDB(db), key);
-    //    }
-
-    //    /// <summary>
-    //    /// 删除
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static bool KeyDelete(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        try
-    //        {
-    //            string strFd = GetDescription(folder);
-    //            return Manager.GetDatabase(GetOperationDB(db)).KeyDelete(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key);
-    //        }
-    //        catch (Exception)
-    //        {
-    //            return false;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 批量删除
-    //    /// </summary>
-    //    /// <param name="keys">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static long KeyDelete(List<string> keys, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        try
-    //        {
-    //            string strFd = GetDescription(folder);
-    //            return Manager.GetDatabase(GetOperationDB(db)).KeyDelete(ConvertRedisKeys(keys, strFd));
-    //        }
-    //        catch (Exception)
-    //        {
-    //            return 0;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// 缓存单个字符串
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="value">值</param>
-    //    /// <param name="expireMinutes">过期时间,单位:分钟</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static bool StringSet(string key, string value, int expireMinutes = 600, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).StringSet(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, value, TimeSpan.FromMinutes(expireMinutes));
-    //    }
-
-    //    /// <summary>
-    //    /// 批量缓存字符串
-    //    /// </summary>
-    //    /// <param name="keysStr">键</param>
-    //    /// <param name="valuesStr">值</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static bool StringSet(string[] keysStr, string[] valuesStr, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        var vCount = keysStr.Length;
-    //        var vKeyValuePair = new KeyValuePair<RedisKey, RedisValue>[vCount];
-    //        for (int i = 0; i < vCount; i++)
-    //        {
-    //            vKeyValuePair[i] = new KeyValuePair<RedisKey, RedisValue>(string.IsNullOrEmpty(strFd) ? keysStr[i] : strFd + ":" + keysStr[i], valuesStr[i]);
-    //        }
-    //        return Manager.GetDatabase(GetOperationDB(db)).StringSet(vKeyValuePair);
-    //    }
-
-    //    /// <summary>
-    //    /// 缓存限时对象
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="obj">值</param>
-    //    /// <param name="expireMinutes">过期时间,单位:分钟</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static bool StringSet<T>(string key, T obj, int expireMinutes = 600, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).StringSet(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, JsonConvert.SerializeObject(obj), TimeSpan.FromMinutes(expireMinutes));
-    //    }
-
-    //    /// <summary>
-    //    /// 缓存对象
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="obj">值</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static bool StringSet<T>(string key, T obj, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).StringSet(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, JsonConvert.SerializeObject(obj));
-    //    }
-
-    //    /// <summary>
-    //    /// 根据key获取值
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static string StringGet(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).StringGet(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key);
-    //    }
-
-    //    /// <summary>
-    //    /// 批量根据key获取
-    //    /// </summary>
-    //    /// <param name="keys">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static RedisValue[] StringGet(List<string> keys, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).StringGet(ConvertRedisKeys(keys, strFd));
-    //    }
-
-    //    /// <summary>
-    //    /// 根据key获取单个对象
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static T StringGet<T>(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        string vValue = Manager.GetDatabase(GetOperationDB(db)).StringGet(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key);
-    //        return ConvertObj<T>(vValue);
-    //    }
-
-
-
-    //    /// <summary>
-    //    /// 入栈(后插入的在List前面)
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="value">值</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    public static long ListLeftPush<T>(string key, T value, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).ListLeftPush(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, ConvertJson(value));
-    //    }
-
-    //    /// <summary>
-    //    /// 批量入栈(后插入的在List前面)
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="values">值</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static long ListLeftPush<T>(string key, List<T> values, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        var vRedisValues = values.Select(m => (RedisValue)ConvertJson(m)).ToArray();
-    //        return Manager.GetDatabase(GetOperationDB(db)).ListLeftPush(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, vRedisValues);
-    //    }
-
-    //    /// <summary>
-    //    /// 出栈(删除最前面的一个元素并返回)
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static T ListLeftPop<T>(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        var vRedisValues = Manager.GetDatabase(GetOperationDB(db)).ListLeftPop(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key);
-    //        return ConvertObj<T>(vRedisValues);
-    //    }
-
-    //    /// <summary>
-    //    /// 入队(后插入的在List后面)
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="value">值</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    public static long ListRightPush<T>(string key, T value, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).ListRightPush(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, ConvertJson(value));
-    //    }
-
-    //    /// <summary>
-    //    /// 批量入队(后插入的在List后面)
-    //    /// </summary>
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="values">值</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static long ListRightPush<T>(string key, List<T> values, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        var vRedisValues = values.Select(m => (RedisValue)ConvertJson(m)).ToArray();
-    //        return Manager.GetDatabase(GetOperationDB(db)).ListRightPush(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, vRedisValues);
-    //    }
-
-    //    /// <summary>
-    //    /// 获取
-    //    /// <typeparam name="T">类型</typeparam>
-    //    /// <param name="key">键</param>
-    //    /// <param name="start">索引开始</param>
-    //    /// <param name="stop">索引结束</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static List<T> ListRange<T>(string key, long start = 0, long stop = -1, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        var vRedisValues = Manager.GetDatabase(GetOperationDB(db)).ListRange(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key, start, stop);
-    //        return ConvetList<T>(vRedisValues);
-    //    }
-
-    //    /// <summary>
-    //    /// 获取个数
-    //    /// </summary>
-    //    /// <param name="key">键</param>
-    //    /// <param name="folder">目录,默认根目录</param>
-    //    /// <param name="db">库,默认读取配置文件</param>
-    //    /// <returns></returns>
-    //    public static long ListLength(string key, RedisFolderEnum folder = RedisFolderEnum.Root, RedisEnum db = RedisEnum.DB0)
-    //    {
-    //        string strFd = GetDescription(folder);
-    //        return Manager.GetDatabase(GetOperationDB(db)).ListLength(string.IsNullOrEmpty(strFd) ? key : strFd + ":" + key);
-    //    }
-
-
-    //}
-    #endregion
-
-    #region MyRegion
-
-    /// <summary>
-    /// Redis帮助类
-    /// </summary>
-    //public class RedisHelper : IDisposable
-    //{
-    //    private static readonly object Locker = new object();
-    //    private static ConnectionMultiplexer redis = null;
-    //    private static bool connected = false;
-    //    private IDatabase db = null;
-    //    private static string _ip;
-    //    private static string _port;
-    //    private static string _pwd;
-
-    //    public bool IsConnected { get { GetRedisConnect(); return redis.IsConnected; } }
-
-    //    //public RedisHelper(string ip, string port, string pwd = "")
-    //    //{
-    //    //    _ip = ip;
-    //    //    _port = port;
-    //    //    _pwd = pwd;
-    //    //}
-
-    //    /// <summary>
-    //    /// Redis连接
-    //    /// </summary>
-    //    /// <returns></returns>
-    //    private int GetRedisConnect()
-    //    {
-    //        if (connected)
-    //        {
-    //            return 0;
-    //        }
-    //        lock (Locker)
-    //        {
-    //            if (redis == null || !redis.IsConnected)
-    //            {
-    //                redis = ConnectionMultiplexer.Connect($"{_ip}:{_port},password={_pwd},abortConnect = false");
-    //            }
-    //        }
-    //        connected = true;
-    //        return 0;
-    //    }
-
-    //    public void Using(Action<RedisHelper> action)
-    //    {
-    //        using (var redisHelper = new RedisHelper(_ip, _port, _pwd))
-    //        {
-    //            action(redisHelper);
-    //        }
-    //    }
-
-    //    public RedisHelper Use(int redisEnum)
-    //    {
-    //        db = redis.GetDatabase(redisEnum);
-    //        //Log.Logs($"RedisDB Conntet State: {redis.IsConnected}");
-    //        var t = db.Ping();
-    //        //Log.Logs($"RedisDB Select {i}, Ping.{t.TotalMilliseconds}ms");
-    //        return this;
-    //    }
-
-    //    public void Close(bool allowCommandsToComplete = true)
-    //    {
-    //        if (redis != null)
-    //        {
-    //            redis.Close(allowCommandsToComplete);
-    //        }
-    //    }
-
-    //    public void CloseAsync(bool allowCommandsToComplete = true)
-    //    {
-    //        if (redis != null)
-    //        {
-    //            redis.CloseAsync(allowCommandsToComplete);
-    //        }
-    //    }
-
-    //    public void Dispose()
-    //    {
-    //        db = null;
-    //    }
-
-    //    #region 发布订阅
-
-    //    public delegate void RedisDeletegate(string str);
-    //    public event RedisDeletegate RedisSubMessageEvent;
-
-    //    /// <summary>
-    //    /// 发布消息
-    //    /// </summary>
-    //    /// <param name="channel"></param>
-    //    /// <param name="msg"></param>
-    //    /// <returns></returns>
-    //    public long RedisPublish(string channel, string msg)
-    //    {
-    //        ISubscriber sub = redis.GetSubscriber();
-    //        return sub.Publish(channel, msg);
-    //    }
-
-    //    /// <summary>
-    //    /// 订阅消息
-    //    /// </summary>
-    //    /// <param name="subChannael"></param>
-    //    /// <param name=""></param>
-    //    public void RedisSubScribe(string subChannael)
-    //    {
-    //        ISubscriber sub = redis.GetSubscriber();
-    //        sub.Subscribe(subChannael, (channel, message) =>
-    //        {
-    //            RedisSubMessageEvent?.Invoke(message); //触发事件
-    //        });
-    //    }
-
-    //    /// <summary>
-    //    /// 取消订阅
-    //    /// </summary>
-    //    /// <param name="channel"></param>
-    //    public void Unsubscribe(string channel)
-    //    {
-    //        ISubscriber sub = redis.GetSubscriber();
-    //        sub.Unsubscribe(channel);
-    //    }
-
-    //    /// <summary>
-    //    /// 取消全部订阅
-    //    /// </summary>
-    //    public void UnsubscribeAll()
-    //    {
-    //        ISubscriber sub = redis.GetSubscriber();
-    //        sub.UnsubscribeAll();
-    //    }
-
-    //    #endregion
-
-    //    #region String类型操作
-
-    //    /// <summary>
-    //    ///  设置指定key 的值(默认第0个库)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <param name="strValue"></param>
-    //    /// <returns></returns>
-    //    public bool InsertStr(string strKey, string strValue)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.StringSet(strKey, strValue);
-    //    }
-
-    //    /// <summary>
-    //    ///  设置指定key 的值(指定库)
-    //    /// </summary>
-    //    /// <param name="strKey"></param>
-    //    /// <param name="strValue"></param>
-    //    /// <param name="database"></param>
-    //    /// <returns></returns>
-    //    public bool InsertStr(string strKey, string strValue, int database)
-    //    {
-    //        var db = redis.GetDatabase(database);
-    //        return db.StringSet(strKey, strValue);
-    //    }
-
-    //    /// <summary>
-    //    ///  设置指定key 的值(指定第一个库,指定过期时间)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <param name="strValue"></param>
-    //    /// <param name="expire"></param>
-    //    public bool InsertStrExpire(string strKey, string strValue, DateTime expire)
-    //    {
-    //        var db = redis.GetDatabase(1);
-    //        db.StringSet(strKey, strValue);
-    //        return db.KeyExpire(strKey, expire);
-    //    }
-
-    //    /// <summary>
-    //    ///   设置指定key 的值(指定第一个库,指定过期分钟数)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <param name="strValue"></param>
-    //    /// <param name="timespanmin"></param>
-    //    public bool InsertStrExpire(string strKey, string strValue, int timespanmin)
-    //    {
-    //        var db = redis.GetDatabase(1);
-    //        return db.StringSet(strKey, strValue, TimeSpan.FromMinutes(timespanmin));
-    //    }
-
-    //    /// <summary>
-    //    ///   设置指定key 的值(指定第一个库,指定过期分钟数)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <param name="strValue"></param>
-    //    /// <param name="timespanmin"></param>
-    //    public void InsertStrExpireByDatabaseOne(string strKey, string strValue, int timespanmin)
-    //    {
-    //        var db = redis.GetDatabase(1);
-    //        db.StringSet(strKey, strValue, TimeSpan.FromMinutes(timespanmin));
-    //    }
-
-    //    /// <summary>
-    //    ///   获取指定 key 的值(默认第0个库)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <returns></returns>
-    //    public string ReadStr(string strKey)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.StringGet(strKey);
-    //    }
-
-    //    /// <summary>
-    //    /// 获取指定 key 的值(指定第一个库)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <returns></returns>
-    //    public string ReadStrByDatabaseOne(string strKey)
-    //    {
-    //        var db = redis.GetDatabase(1);
-    //        return db.StringGet(strKey);
-    //    }
-
-    //    /// <summary>
-    //    /// 获取指定 key 的值(指定第一个库)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <param name="database"></param>
-    //    /// <returns></returns>
-    //    public string ReadStrByDatabase(string strKey, int database)
-    //    {
-    //        var db = redis.GetDatabase(database);
-    //        return db.StringGet(strKey);
-    //    }
-
-    //    /// <summary>
-    //    /// 删除指定key的值(默认第0个库)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    public bool DeleteStr(string strKey)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.KeyDelete(strKey);
-    //    }
-    //    /// <summary>
-    //    /// 删除指定key的值(默认第0个库)
-    //    /// </summary>
-    //    /// <param name="strKey">指定key的值</param>
-    //    /// <param name="database">指定库的值</param>
-    //    public bool DeleteStrByDatabase(string strKey, int database)
-    //    {
-    //        var db = redis.GetDatabase(database);
-    //        return db.KeyDelete(strKey);
-    //    }
-    //    public bool Exist(string strKey)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.KeyExists(strKey);
-    //    }
-    //    #endregion
-
-    //    #region Hash类型操作
-    //    public bool InsertHash(string tablename, string strKey, string strValue)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.HashSet(tablename, strKey, strValue);
-    //    }
-    //    public string ReadHash(string tablename, string strKey)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.HashGet(tablename, strKey);
-    //    }
-    //    public bool ExistHash(string tablename, string strKey)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.HashExists(tablename, strKey);
-    //    }
-    //    public bool DeleteHash(string tablename, string strKey)
-    //    {
-    //        var db = redis.GetDatabase();
-    //        return db.HashDelete(tablename, strKey);
-    //    }
-    //    #endregion
-    //}
-    #endregion
-
 
     public class RedisHelper : IDisposable
     {