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


C# AerospikeClient.GetLargeSet方法代码示例

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


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

示例1: RunExample

        /// <summary>
        /// Perform operations on a list within a single bin.
        /// </summary>
        public override void RunExample(AerospikeClient client, Arguments args)
        {
            if (!args.hasLargeDataTypes)
            {
                console.Info("Large set functions are not supported by the connected Aerospike server.");
                return;
            }

            Key key = new Key(args.ns, args.set, "setkey");
            string binName = args.GetBinName("setbin");

            // Delete record if it already exists.
            client.Delete(args.writePolicy, key);

            // Initialize large set operator.
            Aerospike.Client.LargeSet set = client.GetLargeSet(args.writePolicy, key, binName, null);

            // Write values.
            set.Add(Value.Get("setvalue1"));
            set.Add(Value.Get("setvalue2"));
            set.Add(Value.Get("setvalue3"));

            // Verify large set was created with default configuration.
            IDictionary map = set.GetConfig();

            foreach (DictionaryEntry entry in map)
            {
                console.Info(entry.Key.ToString() + ',' + entry.Value);
            }

            // Remove last value.
            set.Remove(Value.Get("setvalue3"));

            int size = set.Size();

            if (size != 2)
            {
                throw new Exception("Size mismatch. Expected 2 Received " + size);
            }

            string received = (string)set.Get(Value.Get("setvalue2"));
            string expected = "setvalue2";

            if (received != null && received.Equals(expected))
            {
                console.Info("Data matched: namespace={0} set={1} key={2} value={3}", key.ns, key.setName, key.userKey, received);
            }
            else
            {
                console.Error("Data mismatch: Expected {0}. Received {1}.", expected, received);
            }
        }
开发者ID:vonbv,项目名称:aerospike-client-csharp,代码行数:55,代码来源:LargeSet.cs


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