Created
December 21, 2012 15:31
-
-
Save anonymous/4353487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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