Exemplo n.º 1
0
        public MonkeyCacheActiveDirectoryProvider(IActiveDirectoryProvider activeDirectoryProvider, string applicationId, double expiryLengthDays = 1.0, bool refresh = false) : base(activeDirectoryProvider)
        {
            Barrel.ApplicationId = applicationId;
            _barrel           = Barrel.Current;
            _expiryLengthDays = expiryLengthDays;

            if (refresh)
            {
                _barrel.EmptyAll();
            }
            else
            {
                _barrel.EmptyExpired();
            }
        }
Exemplo n.º 2
0
        public void EmptyExpiredTest()
        {
            var url2 = "url2";

            //Saves the cache and pass it a timespan for expiration
            barrel.Add(key: url, data: monkeys, expireIn: TimeSpan.FromDays(1));
            barrel.Add(key: url2, data: monkeys, expireIn: TimeSpan.FromDays(-1));



            Assert.IsTrue(barrel.Exists(url));
            Assert.IsTrue(barrel.Exists(url2));

            barrel.EmptyExpired();

            Assert.IsTrue(barrel.Exists(url));
            Assert.IsFalse(barrel.Exists(url2));
        }