本文整理汇总了C#中CouchbaseClient.Increment方法的典型用法代码示例。如果您正苦于以下问题:C# CouchbaseClient.Increment方法的具体用法?C# CouchbaseClient.Increment怎么用?C# CouchbaseClient.Increment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CouchbaseClient
的用法示例。
在下文中一共展示了CouchbaseClient.Increment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public override void Run()
{
var config = new CouchbaseClientConfiguration();
config.Urls.Add(new Uri("http://localhost:8091/pools/"));
config.Bucket = "default";
var client = new CouchbaseClient(config);
Console.WriteLine("Set the counter to 0");
client.Increment("counter", 0, 0);
Console.WriteLine("Increment by 1, set initial value to 0");
client.Increment("counter", 0, 1);
Console.WriteLine(client.Get("counter"));
Console.WriteLine("Increment by 10, initial value is ignored since it exists");
client.Increment("counter", 0, 10);
Console.WriteLine(client.Get("counter"));
client.Remove("counter");
Console.WriteLine("Set the counter to 1000");
client.Decrement("counter", 1000, 0);
Console.WriteLine("Decrement by 1");
client.Decrement("counter", 0, 1);
Console.WriteLine(client.Get("counter"));
Console.WriteLine("Decrement by 10, initial value is ignored since it exists");
client.Decrement("counter", 0, 10);
Console.WriteLine(client.Get("counter"));
}