Skip to content

Instantly share code, notes, and snippets.

Created December 21, 2012 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4353487 to your computer and use it in GitHub Desktop.
Save anonymous/4353487 to your computer and use it in GitHub Desktop.
<?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>
<?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>
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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment