Exemplo n.º 1
0
        /// <summary>
        /// Check routine.
        /// </summary>
        /// <param name="cacheName">Cache name.</param>
        private void Check(string cacheName)
        {
            ICache <DynamicTestKey, DynamicTestValue> cacheData =
                Ignition.GetIgnite(GridData).GetCache <DynamicTestKey, DynamicTestValue>(cacheName);

            ICache <DynamicTestKey, DynamicTestValue> cacheDataNoCfg =
                Ignition.GetIgnite(GridDataNoCfg).GetCache <DynamicTestKey, DynamicTestValue>(cacheName);

            ICache <DynamicTestKey, DynamicTestValue> cacheClient =
                Ignition.GetIgnite(GridClient).GetCache <DynamicTestKey, DynamicTestValue>(cacheName);

            DynamicTestKey key1 = new DynamicTestKey(1);
            DynamicTestKey key2 = new DynamicTestKey(2);
            DynamicTestKey key3 = new DynamicTestKey(3);

            DynamicTestValue val1 = new DynamicTestValue(1);
            DynamicTestValue val2 = new DynamicTestValue(2);
            DynamicTestValue val3 = new DynamicTestValue(3);

            cacheData.Put(key1, val1);
            Assert.AreEqual(val1, cacheData.Get(key1));
            Assert.AreEqual(val1, cacheDataNoCfg.Get(key1));
            Assert.AreEqual(val1, cacheClient.Get(key1));

            cacheDataNoCfg.Put(key2, val2);
            Assert.AreEqual(val2, cacheData.Get(key2));
            Assert.AreEqual(val2, cacheDataNoCfg.Get(key2));
            Assert.AreEqual(val2, cacheClient.Get(key2));

            cacheClient.Put(key3, val3);
            Assert.AreEqual(val3, cacheData.Get(key3));
            Assert.AreEqual(val3, cacheDataNoCfg.Get(key3));
            Assert.AreEqual(val3, cacheClient.Get(key3));

            for (int i = 0; i < 10000; i++)
            {
                cacheClient.Put(new DynamicTestKey(i), new DynamicTestValue(1));
            }

            int sizeClient = cacheClient.GetLocalSize();

            Assert.AreEqual(0, sizeClient);
        }
            /** <inheritdoc /> */
            public override bool Equals(object obj)
            {
                DynamicTestKey other = obj as DynamicTestKey;

                return(other != null && Id == other.Id);
            }
        /// <summary>
        /// Check routine.
        /// </summary>
        /// <param name="cacheName">Cache name.</param>
        private void Check(string cacheName)
        {
            ICache<DynamicTestKey, DynamicTestValue> cacheData =
                Ignition.GetIgnite(GridData).Cache<DynamicTestKey, DynamicTestValue>(cacheName);

            ICache<DynamicTestKey, DynamicTestValue> cacheDataNoCfg =
                Ignition.GetIgnite(GridDataNoCfg).Cache<DynamicTestKey, DynamicTestValue>(cacheName);

            ICache<DynamicTestKey, DynamicTestValue> cacheClient =
                Ignition.GetIgnite(GridClient).Cache<DynamicTestKey, DynamicTestValue>(cacheName);

            DynamicTestKey key1 = new DynamicTestKey(1);
            DynamicTestKey key2 = new DynamicTestKey(2);
            DynamicTestKey key3 = new DynamicTestKey(3);

            DynamicTestValue val1 = new DynamicTestValue(1);
            DynamicTestValue val2 = new DynamicTestValue(2);
            DynamicTestValue val3 = new DynamicTestValue(3);

            cacheData.Put(key1, val1);
            Assert.AreEqual(val1, cacheData.Get(key1));
            Assert.AreEqual(val1, cacheDataNoCfg.Get(key1));
            Assert.AreEqual(val1, cacheClient.Get(key1));

            cacheDataNoCfg.Put(key2, val2);
            Assert.AreEqual(val2, cacheData.Get(key2));
            Assert.AreEqual(val2, cacheDataNoCfg.Get(key2));
            Assert.AreEqual(val2, cacheClient.Get(key2));

            cacheClient.Put(key3, val3);
            Assert.AreEqual(val3, cacheData.Get(key3));
            Assert.AreEqual(val3, cacheDataNoCfg.Get(key3));
            Assert.AreEqual(val3, cacheClient.Get(key3));

            for (int i = 0; i < 10000; i++)
                cacheClient.Put(new DynamicTestKey(i), new DynamicTestValue(1));

            int sizeClient = cacheClient.LocalSize();

            Assert.AreEqual(0, sizeClient);
        }