Example #1
0
        /// <summary>
        /// 异步保存数据DB文件到硬盘
        /// </summary>
        public static void SaveAsync()
        {
            IRedisClient Core;

            try
            {
                using  (Core = RedisManager.GetReadOnlyClient())
                {
                    Core.SaveAsync();
                }
            }
            catch (RedisException ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// 从链接池中获取一个只读连接,并执行对应的方法
        /// </summary>
        /// <typeparam name="F"></typeparam>
        /// <param name="doRead"></param>
        /// <returns></returns>
        public static F RedisRead <F>(Func <IRedisClient, F> doRead)
        {
            IRedisClient Core;

            try
            {
                using  (Core = RedisManager.GetReadOnlyClient())
                {
                    return(doRead(Core));
                }
            }
            catch (RedisException ex)
            {
                // return default(F);
                throw new Exception("Redis写入异常.Host:" + ex.Message);
            }
        }