Exemplo n.º 1
0
        public RedisHelper(ConnectionMultiplexer redis, int?dbNum)
        {
            //Retrieve the Redis DB with the specified number (by default, there are 16), default to 0.
            var db = redis.GetDatabase(dbNum.HasValue ? dbNum.Value : 0);

            //Initialize helper / wrappers with the database.
            Database = new RedisDatabaseHelper(db);
            Streams  = new RedisStreamsHelper(db);
        }
Exemplo n.º 2
0
 public RedisDbRepository()
 {
     //Gubantorious 4.21.18 - We need to make sure we persist this connection, we don't want multiple connections within the app
     //Implementing now for testability, we will want to blend this into the repository / DI patterns
     _redis = new RedisStreamsHelper(ConnectionMultiplexer.Connect("localhost"));
 }