public
anonymous / App.config
Created

  • Download Gist
App.config
1 2 3 4 5 6 7 8 9 10 11 12
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="localcouchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase" />
</configSections>
 
<localcouchbase>
<servers bucket="default">
<add uri="http://localhost:8091/pools" />
</servers>
</localcouchbase>
</configuration>
Program.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
using System;
using System.Configuration;
using Couchbase;
using Couchbase.Configuration;
 
namespace CouchbaseIncrementWithCASTest
{
class Program
{
static void Main(string[] args)
{
var couchbaseClient = new CouchbaseClient((ICouchbaseClientConfiguration)ConfigurationManager.GetSection("localcouchbase"));
var cacheKey = Guid.NewGuid().ToString();
var casResult = couchbaseClient.GetWithCas<ulong>(cacheKey);
var incrementResult = couchbaseClient.Increment(cacheKey, (ulong)DateTime.Now.Ticks, 0, TimeSpan.FromMinutes(1), casResult.Cas);
Console.WriteLine(incrementResult.Result);
}
}
}
packages.config
1 2 3 4 5 6
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CouchbaseNetClient" version="1.2.0" targetFramework="net40" />
<package id="Hammock" version="1.2.9" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
</packages>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.