Example #1
0
        }                                               //队列Key值

        static RedisQueueLogic()
        {
            RedisConnectOptions redisConnectOptions = SherlockEngine.Current.GetService <IOptionsSnapshot <RedisConnectOptions> >().Value;

            //如果Redis在使用,将队列的Key值附上
            if (RedisQueueKey.IsNullOrWhiteSpace())
            {
                RedisCacheKeyOptions redisCacheKeyOptions = SherlockEngine.Current.GetService <IOptionsSnapshot <RedisCacheKeyOptions> >().Value;
                RedisQueueKey = $"{redisCacheKeyOptions.Region}:Msg:Queue";
            }
            if (redisConnectOptions == null)
            {
                _isUseRedisQueue = false;
            }
            else
            {
                queue = new RedisQueueCache <T>();
                try
                {
                    queue.InitRedisDataBase(redisConnectOptions.Server, redisConnectOptions.Port, redisConnectOptions.DataBaseNo, redisConnectOptions.Password);
                    //LogHelper.Info.Write(TAG, string.Format("RedisServer:{0},RedisPassword={1},初始化成功", redisServer, redisPassword));
                }
                catch (Exception ex)
                {
                    _isUseRedisQueue = false;
                    //LogHelper.Error.Write(TAG, string.Format("RedisServer:{0},RedisPassword={1},初始化失败", redisServer, redisPassword));
                }
            }
        }
Example #2
0
 public static void AddRedisCacheKeyOptions(RedisCacheKeyOptions redisCacheKeyOptions)
 {
     //RedisCacheKeyOptions = redisCacheKeyOptions;
 }