コード例 #1
0
        public DistributedEventBusService(IRedisFactory redisFactory, IMemoryEventBusService memoryEventBusService)
        {
            _connectionMultiplexer = redisFactory.CreateConnection();
            _subscriber            = _connectionMultiplexer.GetSubscriber();

            _subscriber.Subscribe(GetChannel(), (channel, json) =>
            {
                var jObj       = JObject.Parse(json);
                var eventName  = jObj.Value <string>("EventName");
                var parameters = (JArray)jObj["Parameters"];

                var invokeParameters = new List <object>(parameters.Count);
                foreach (var parameter in parameters)
                {
                    var typeName = parameter.Value <string>("TypeName");
                    var content  = parameter.Value <string>("Content");

                    var type = Type.GetType(typeName, false);
                    if (type == null)
                    {
                        continue;
                    }

                    invokeParameters.Add(JsonConvert.DeserializeObject(content, type));
                }
                try
                {
                    memoryEventBusService.PublishRequest(eventName, invokeParameters.ToArray());
                }
                catch (Exception ex)
                {
                    _Logger.Error("DistributedEventBusService_Exception:", ex);
                }
            });
        }
コード例 #2
0
 public AppStatsService(IAppUserService appUserService,
                        IRedisFactory redisFactory,
                        INumbersFactory numbersFactory)
 {
     this.appUserService = appUserService ?? throw new ArgumentNullException(nameof(appUserService));
     this.redisFactory   = redisFactory ?? throw new ArgumentNullException(nameof(redisFactory));
     this.numbersFactory = numbersFactory ?? throw new ArgumentNullException(nameof(numbersFactory));
 }
コード例 #3
0
 public UsersController(ILogger <UsersController> logger, IUsersService usersService, IConfiguration configuration,
                        IUserRoleService userRoleService, IRedisFactory redisFactory)
 {
     _logger          = logger;
     _usersService    = usersService;
     _configuration   = configuration;
     _userRoleService = userRoleService;
     _redisFactory    = redisFactory;
 }
コード例 #4
0
ファイル: RedisStore.cs プロジェクト: jazeem-azeez/DMPC
        public RedisStore(IRedisFactory redisFactory, ICacheConfig cacheConfig, ICacheLogger cacheLogger)
        {
            this._cacheConfig = cacheConfig;
            this._cacheLogger = cacheLogger;
            long index = (typeof(T).FullName.Select(c => Convert.ToInt64(c)).Aggregate((cur, next) => cur + next)) % 16;

            this._cacheLogger.LogAsync($"Connecting to RedisDB:{index}", System.Diagnostics.Tracing.EventLevel.Verbose);
            this.DB = redisFactory.Connection?.GetDatabase((int)index);
        }
コード例 #5
0
 public AppUserService(IRedisFactory redisFactory)
 {
     this.redisFactory = redisFactory ?? throw new ArgumentNullException(nameof(redisFactory));
 }
コード例 #6
0
 public NumbersFactory(IRedisFactory redisFactory)
 {
     this.redisFactory = redisFactory ?? throw new ArgumentNullException(nameof(redisFactory));
 }
コード例 #7
0
ファイル: CacheService.cs プロジェクト: bcage29/Redis
 public CacheService(IRedisFactory redisFactory, ILogger <CacheService> logger)
 {
     _redisFactory = redisFactory;
     _logger       = logger;
 }
コード例 #8
0
 public static IConnectionMultiplexer Default(this IRedisFactory redisFactory)
 {
     return(redisFactory.Get(Options.DefaultName));
 }
コード例 #9
0
 public SignInEventBusProviders(IMemoryEventBusService memoryEventBusService, IRedisFactory redisFactory)
 {
     _memoryEventBusService = memoryEventBusService;
     _connectionMultiplexer = redisFactory.CreateConnection();
 }
コード例 #10
0
 public UserService(IMemoryEventBusService memoryEventBusService, IRedisFactory redisFactory)
 {
     _memoryEventBusService = memoryEventBusService;
     _connectionMultiplexer = redisFactory.CreateConnection();
     _cookieAccountId       = CookieHelper.GetCookieValue(SystemConfig.CookiesKey);
 }
コード例 #11
0
 public RedisCacheManager(IRedisFactory redisFactory)
 {
     _redisFactory = redisFactory;
 }
コード例 #12
0
 public StoreCollectionProvider(IRedisFactory redisFactory, ICacheConfig cacheConfig, ICacheLogger cacheLogger)
 {
     this._redisFactory = redisFactory;
     this._cacheConfig  = cacheConfig;
     this._cacheLogger  = cacheLogger;
 }
コード例 #13
0
 public AdminAttribute(IRedisFactory redisFactory)
 {
     _connectionMultiplexer = redisFactory.CreateConnection();
 }
コード例 #14
0
 public TokenService(IRedisFactory redisFactory)
 {
     _connectionMultiplexer = redisFactory.CreateConnection();
     _database  = _connectionMultiplexer.GetDatabase();
     _channelId = 0019;
 }
コード例 #15
0
 public RedisCacheString(IRedisFactory redisFactory)
     : base(redisFactory)
 {
 }
コード例 #16
0
ファイル: SortedSetTests.cs プロジェクト: pjtown/csharp-redis
 public void TestFixtureSetUp()
 {
     this.redisFactory = new RedisFactory();
 }
コード例 #17
0
 public RedisCacheHash(IRedisFactory redisFactory)
 {
     _redisFactory = redisFactory;
 }