Exemple #1
0
        public static void Initialize(string redisConnector, Guid sender)
        {
            _redisConnector = redisConnector;
            _sender         = sender;

            //创建连接
            _redis = RedisConnector.Open(redisConnector);

            _subscriber = _redis.GetSubscriber();
        }
Exemple #2
0
        public DistributedMemoryCache(CacheOption option)
        {
            string redisConnector = option?.Params?[_redisConnectorKey]?.ToString();

            if (string.IsNullOrEmpty(redisConnector))
            {
                throw new ArgumentNullException(_redisConnectorKey);
            }

            //创建连接
            _redis = RedisConnector.Open(redisConnector);

            _subscriber = _redis.GetSubscriber();

            //订阅CacheRunner的通道
            _subscriber.Subscribe(_channel, Broker_MsgRecevied);

            CacheSyncMsgDispatcher.Initialize(redisConnector, _self);
        }