public async Task Cache_Dist_Test_Caching_Byte_Arrays()
        {
            // ARRANGE
            var ca1 = new CacheAccessor(new CacheConfig {
                IsAuditingEnabled = true
            });
            var ca2 = new CacheAccessor(new CacheConfig {
                IsAuditingEnabled = true
            });

            await ca1.InitialiseIfNecessaryAsync();

            await ca2.InitialiseIfNecessaryAsync();

            var KEY1   = CreateGuid();
            var VALUE1 = new byte[] { 32, 34, 55 };
            var KEY2   = CreateGuid();
            var VALUE2 = new byte[] { 1, 11, 33 };

            // ACT
            await ca1.SetAsync(KEY1, VALUE1); // set the value

            await ca2.WaitForEvent(eCacheEvent.KeySetInMemory);

            await ca2.SetAsync(KEY2, VALUE2); // set the value

            await ca1.WaitForEvent(eCacheEvent.KeySetInMemory);

            var data1 = await ca2.GetWithMetaDataAsync <byte[]>(KEY1);

            var data2 = await ca1.GetWithMetaDataAsync <byte[]>(KEY2);

            Assert.AreEqual(VALUE1.Length, data1.Data.Length);
            Assert.AreEqual(VALUE2.Length, data2.Data.Length);
            Assert.AreEqual(VALUE1[0], data1.Data[0]);
            Assert.AreEqual(VALUE1[1], data1.Data[1]);
            Assert.AreEqual(VALUE1[2], data1.Data[2]);

            Assert.AreEqual(VALUE2[0], data2.Data[0]);
            Assert.AreEqual(VALUE2[1], data2.Data[1]);
            Assert.AreEqual(VALUE2[2], data2.Data[2]);
        }
        public async Task Cache_Dist_Test_That_Cache_Expiry_Works_OK()
        {
            // ARRANGE
            var ca1 = new CacheAccessor(new CacheConfig {
                IsAuditingEnabled = true
            });
            var ca2 = new CacheAccessor(new CacheConfig {
                IsAuditingEnabled = true
            });

            await ca1.InitialiseIfNecessaryAsync();

            await ca2.InitialiseIfNecessaryAsync();

            var KEY   = CreateGuid();
            var VALUE = CreateGuid();

            // ACT
            await ca1.SetAsync(KEY, VALUE, TimeSpan.FromSeconds(5));

            await ca2.WaitForEvent(eCacheEvent.KeySetInMemory);

            var v1 = await ca2.GetWithMetaDataAsync <string>(KEY);

            var v2 = await ca1.GetWithMetaDataAsync <string>(KEY);

            await Task.Delay(5000);

            var v3 = await ca2.GetWithMetaDataAsync <string>(KEY);

            var v4 = await ca1.GetWithMetaDataAsync <string>(KEY);

            Assert.IsNotNull(v1.Data);
            Assert.IsNotNull(v2.Data);
            Assert.IsTrue(v1.IsFromInMemoryCache);
            Assert.IsTrue(v2.IsFromInMemoryCache);

            Assert.IsNull(v3.Data);
            Assert.IsNull(v4.Data);
            Assert.IsTrue(v3.IsFromCentralCacheServer);
            Assert.IsTrue(v4.IsFromCentralCacheServer);
        }
        public async Task Cache_Dist_Test_That_Cache_Delete_Key_Works_OK()
        {
            // ARRANGE
            var ca1 = new CacheAccessor(new CacheConfig {
                IsAuditingEnabled = true
            });
            var ca2 = new CacheAccessor(new CacheConfig {
                IsAuditingEnabled = true
            });

            await ca1.InitialiseIfNecessaryAsync();

            await ca2.InitialiseIfNecessaryAsync();

            var KEY   = CreateGuid();
            var VALUE = CreateGuid();

            // ACT
            await ca1.SetAsync(KEY, VALUE); // set the value

            // Wait for propagation to ca2
            await ca2.WaitForEvent(eCacheEvent.KeySetInMemory);

            var v1 = await ca2.GetWithMetaDataAsync <string>(KEY);

            await ca2.DeleteAsync(KEY);

            var propagationTimeInMS = await ca1.WaitForEvent(eCacheEvent.KeyDeletedInMemory);

            var v2 = await ca1.GetWithMetaDataAsync <string>(KEY);

            var v3 = await ca2.GetWithMetaDataAsync <string>(KEY);

            // ASSERT
            Assert.IsNotNull(v1.Data);
            Assert.IsTrue(v1.IsFromInMemoryCache);
            Assert.IsNull(v2.Data);
            Assert.IsTrue(v2.IsFromCentralCacheServer);
            Assert.IsNull(v3.Data);
            Assert.IsTrue(v3.IsFromCentralCacheServer);
        }