当前位置: 首页>>代码示例>>C#>>正文


C# ClientConfig.AddNearCacheConfig方法代码示例

本文整理汇总了C#中ClientConfig.AddNearCacheConfig方法的典型用法代码示例。如果您正苦于以下问题:C# ClientConfig.AddNearCacheConfig方法的具体用法?C# ClientConfig.AddNearCacheConfig怎么用?C# ClientConfig.AddNearCacheConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClientConfig的用法示例。


在下文中一共展示了ClientConfig.AddNearCacheConfig方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestMapConfigWildcardMultipleAmbiguousConfigs

 public virtual void TestMapConfigWildcardMultipleAmbiguousConfigs()
 {
     NearCacheConfig nearCacheConfig1 = new NearCacheConfig().SetName("com.hazelcast*");
     NearCacheConfig nearCacheConfig2 = new NearCacheConfig().SetName("*com.hazelcast");
     ClientConfig config = new ClientConfig();
     config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
     config.AddNearCacheConfig(nearCacheConfig1);
     config.AddNearCacheConfig(nearCacheConfig2);
     config.GetNearCacheConfig("com.hazelcast");
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:10,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例2: TestDuplicateConfig

        public virtual void TestDuplicateConfig()
        {
            NearCacheConfig nearCacheConfig1 = new NearCacheConfig().SetName("com.hazelcast.*ap");
            NearCacheConfig nearCacheConfig2 = new NearCacheConfig().SetName("com.hazelcast*map");
            ClientConfig config = new ClientConfig();
            config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
            config.AddNearCacheConfig(nearCacheConfig1);
            config.AddNearCacheConfig(nearCacheConfig2);

            config.GetNearCacheConfig("com.hazelcast.map");
        }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:11,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例3: TestSpecificNearCacheConfig_whenAsteriskAtTheBeginning

 public virtual void TestSpecificNearCacheConfig_whenAsteriskAtTheBeginning()
 {
     var clientConfig = new ClientConfig();
     var genericNearCacheConfig = new NearCacheConfig();
     genericNearCacheConfig.SetName("*Map");
     clientConfig.AddNearCacheConfig(genericNearCacheConfig);
     var specificNearCacheConfig = new NearCacheConfig();
     specificNearCacheConfig.SetName("*MapStudent");
     clientConfig.AddNearCacheConfig(specificNearCacheConfig);
     var mapFoo = clientConfig.GetNearCacheConfig("fooMap");
     var mapStudentFoo = clientConfig.GetNearCacheConfig("fooMapStudent");
     Assert.AreEqual(genericNearCacheConfig, mapFoo);
     Assert.AreEqual(specificNearCacheConfig, mapStudentFoo);
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:14,代码来源:ClientNearCacheConfigTest.cs

示例4: TestNearCacheConfigWildcard3

 public virtual void TestNearCacheConfigWildcard3()
 {
     NearCacheConfig nearCacheConfig = new NearCacheConfig().SetName("com.hazelcast.test.*");
     ClientConfig config = new ClientConfig();
     config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
     config.AddNearCacheConfig(nearCacheConfig);
     Assert.AreEqual(nearCacheConfig, config.GetNearCacheConfig("com.hazelcast.test.myNearCache"));
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:8,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例5: Run

        public static void Run(string[] args)
        {
            Environment.SetEnvironmentVariable("hazelcast.logging.level", "info");
            Environment.SetEnvironmentVariable("hazelcast.logging.type", "console");

            var config = new ClientConfig();

            var nearCacheConfig = new NearCacheConfig();
            nearCacheConfig.SetMaxSize(1000)
                .SetInvalidateOnChange(true)
                .SetEvictionPolicy("Lru")
                .SetInMemoryFormat(InMemoryFormat.Binary);

            config.AddNearCacheConfig("nearcache-map-*", nearCacheConfig);
            config.GetNetworkConfig().AddAddress("127.0.0.1");

            var client = HazelcastClient.NewHazelcastClient(config);

            var map = client.GetMap<string, string>("nearcache-map-1");

            for (var i = 0; i < 1000; i++)
            {
                map.Put("key" + i, "value" + i);
            }

            var sw = new Stopwatch();

            sw.Start();
            for (var i = 0; i < 1000; i++)
            {
                map.Get("key" + i);
            }
            Console.WriteLine("Got values in " + sw.ElapsedMilliseconds + " millis");

            sw.Restart();
            for (var i = 0; i < 1000; i++)
            {
                map.Get("key" + i);
            }
            Console.WriteLine("Got cached values in " + sw.ElapsedMilliseconds + " millis");

            map.Destroy();
            client.Shutdown();
        }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:44,代码来源:MapNearCacheExample.cs

示例6: TestSpecificNearCacheConfig_whenAsteriskInTheMiddle

 public virtual void TestSpecificNearCacheConfig_whenAsteriskInTheMiddle()
 {
     var clientConfig = new ClientConfig();
     var genericNearCacheConfig = new NearCacheConfig();
     genericNearCacheConfig.SetName("map*Bar");
     clientConfig.AddNearCacheConfig(genericNearCacheConfig);
     var specificNearCacheConfig = new NearCacheConfig();
     specificNearCacheConfig.SetName("mapStudent*Bar");
     clientConfig.AddNearCacheConfig(specificNearCacheConfig);
     var mapFoo = clientConfig.GetNearCacheConfig("mapFooBar");
     var mapStudentFoo = clientConfig.GetNearCacheConfig("mapStudentFooBar");
     Assert.AreEqual(genericNearCacheConfig, mapFoo);
     Assert.AreEqual(specificNearCacheConfig, mapStudentFoo);
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:14,代码来源:ClientNearCacheConfigTest.cs

示例7: TestNearCacheConfigWildcardMatchingPointEndsWith

 public virtual void TestNearCacheConfigWildcardMatchingPointEndsWith()
 {
     NearCacheConfig nearCacheConfig1 = new NearCacheConfig().SetName("*.sub");
     NearCacheConfig nearCacheConfig2 = new NearCacheConfig().SetName("*.test.sub");
     NearCacheConfig nearCacheConfig3 = new NearCacheConfig().SetName("*.hazelcast.test.sub");
     ClientConfig config = new ClientConfig();
     config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
     config.AddNearCacheConfig(nearCacheConfig1);
     config.AddNearCacheConfig(nearCacheConfig2);
     config.AddNearCacheConfig(nearCacheConfig3);
     // we should not match any of the configs (endsWith)
     Assert.AreEqual(null, config.GetNearCacheConfig("com.hazelFast.Fast.sub.myNearCache"));
     Assert.AreEqual(null, config.GetNearCacheConfig("hazelFast.test.sub.myNearCache"));
     Assert.AreEqual(null, config.GetNearCacheConfig("test.sub.myNearCache"));
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:15,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例8: TestNearCacheConfigWithoutWildcard

 public virtual void TestNearCacheConfigWithoutWildcard()
 {
     NearCacheConfig nearCacheConfig = new NearCacheConfig().SetName("someNearCache");
     ClientConfig config = new ClientConfig();
     config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
     config.AddNearCacheConfig(nearCacheConfig);
     Assert.AreEqual(nearCacheConfig, config.GetNearCacheConfig("someNearCache"));
     // non-matching name
     Assert.AreNotEqual(nearCacheConfig, config.GetNearCacheConfig("doesNotExist"));
     // non-matching case
     Assert.AreNotEqual(nearCacheConfig, config.GetNearCacheConfig("SomeNearCache"));
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:12,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例9: TestNearCacheConfigWildcardOnlyMultipleConfigs

 public virtual void TestNearCacheConfigWildcardOnlyMultipleConfigs()
 {
     NearCacheConfig nearCacheConfig1 = new NearCacheConfig().SetName("*");
     NearCacheConfig nearCacheConfig2 = new NearCacheConfig().SetName("com.hazelcast.*");
     ClientConfig config = new ClientConfig();
     config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
     config.AddNearCacheConfig(nearCacheConfig1);
     config.AddNearCacheConfig(nearCacheConfig2);
     // we should get the best matching result
     Assert.AreEqual(nearCacheConfig2, config.GetNearCacheConfig("com.hazelcast.myNearCache"));
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:11,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例10: TestNearCacheConfigWildcardMatchingPointStartsWith

 public virtual void TestNearCacheConfigWildcardMatchingPointStartsWith()
 {
     var nearCacheConfig1 = new NearCacheConfig().SetName("hazelcast.*");
     var nearCacheConfig2 = new NearCacheConfig().SetName("hazelcast.test.*");
     var nearCacheConfig3 = new NearCacheConfig().SetName("hazelcast.test.sub.*");
     var config = new ClientConfig();
     config.SetConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
     config.AddNearCacheConfig(nearCacheConfig1);
     config.AddNearCacheConfig(nearCacheConfig2);
     config.AddNearCacheConfig(nearCacheConfig3);
     // we should not match any of the configs (startsWith)
     Assert.AreEqual(null, config.GetNearCacheConfig("com.hazelcast.myNearCache"));
     Assert.AreEqual(null, config.GetNearCacheConfig("com.hazelcast.test.myNearCache"));
     Assert.AreEqual(null, config.GetNearCacheConfig("com.hazelcast.test.sub.myNearCache"));
 }
开发者ID:ihsandemir,项目名称:hazelcast-csharp-client,代码行数:15,代码来源:MatchingPointConfigPatternMatcherTest.cs

示例11: ConfigureClient

 protected override void ConfigureClient(ClientConfig config)
 {
     base.ConfigureClient(config);
     var nearCacheConfig = new NearCacheConfig().SetInMemoryFormat(InMemoryFormat.Object);
     config.AddNearCacheConfig("nearCachedMap*", nearCacheConfig);
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:6,代码来源:ClientNearCacheTest.cs


注:本文中的ClientConfig.AddNearCacheConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。