Exemplo n.º 1
0
        public void Caching_Clear_Should_Clear_All_Content()
        {
            var storage = new Cactus.Blade.Caching.Caching();
            var key     = Guid.NewGuid().ToString();
            var value   = Guid.NewGuid();

            storage.Store(key, value);
            storage.Persist();

            storage.Clear();

            storage.Count.Should().Be(0);
        }
Exemplo n.º 2
0
        public void Caching_Should_Perform_Decently_With_Large_Collections()
        {
            var stopwatch = Stopwatch.StartNew();
            var storage   = new Cactus.Blade.Caching.Caching();

            for (var i = 0; i < 100000; i++)
            {
                storage.Store(Guid.NewGuid().ToString(), i);
            }

            storage.Persist();

            var target = new Cactus.Blade.Caching.Caching();

            target.Clear();
            stopwatch.Stop();

            target.Destroy();

            stopwatch.ElapsedMilliseconds.Should().BeLessOrEqualTo(1000);
        }