public RedisAgent(string name, string configuration)
 {
     this.name                  = name;
     Redis                      = ConnectionMultiplexer.Connect(configuration);
     keysEvictedProcessor       = new EpochProcessor();
     commandsProcessedProcessor = new EpochProcessor();
 }
示例#2
0
        public void TestTwoValidPollCycles()
        {
            var processor    = new EpochProcessor();
            var firstProcess = processor.Process(5);

            ResetTimer(processor, 1);
            var secondProcess = processor.Process(6);

            Assert.IsNull(firstProcess);
            Assert.AreEqual(1.0, Convert.ToDouble(secondProcess.Value), 0.1);
        }
示例#3
0
        public void TestNullSecondPollCycle()
        {
            var processor    = new EpochProcessor();
            var firstProcess = processor.Process(5);

            ResetTimer(processor, 1);
            var secondProcess = processor.Process(null);

            ResetTimer(processor, 1);
            var thirdProcess = processor.Process(6);

            ResetTimer(processor, 1);
            var fourthProcess = processor.Process(7);

            Assert.IsNull(firstProcess);
            Assert.IsNull(secondProcess);
            Assert.IsNull(thirdProcess);
            Assert.AreEqual(1.0, Convert.ToDouble(fourthProcess.Value), 0.1);
        }
示例#4
0
 private void ResetTimer(EpochProcessor processor, int seconds)
 {
     processor.LastValue = DateTime.Now.Subtract(TimeSpan.FromSeconds(seconds));
 }