using StackExchange.Redis;

namespace Chat
{
    class Redis
    {
        private static ConnectionMultiplexer redis;

        static public ConnectionMultiplexer Ins
        {
            get
            {
                if (null == redis)
                {
                    redis = ConnectionMultiplexer.Connect(Config.Ins.redis);
                }
                return redis;
            }
        }
        /// <summary>
        /// 获取操作redis数据库的接口对象
        /// </summary>
        /// <param name="id">指定db的编号</param>
        /// <returns></returns>
        public static IDatabase Rdb(int id = 0)
        {
            return Ins.GetDatabase(id);
        }

    }
}
