Created
March 20, 2013 16:03
-
-
Save AndrewLane/5205889 to your computer and use it in GitHub Desktop.
Showing flushing a couchbase bucket via API doesn't seem to work
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"?> | |
<configuration> | |
<configSections> | |
<section name="couchbase" type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/> | |
</configSections> | |
<couchbase> | |
<servers bucket="general" bucketPassword=""> | |
<add uri="http://127.0.0.1:8091/pools"/> | |
</servers> | |
</couchbase> | |
</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
Successfully retrieved 372f498f-f98b-4f7a-b251-d13fd826c59a | |
Got 372f498f-f98b-4f7a-b251-d13fd826c59a data when expecting a cache miss |
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 Couchbase; | |
using Enyim.Caching.Memcached; | |
namespace TryToFlushCouchbaseBucket | |
{ | |
class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
//create client object | |
var couchbaseClient = new CouchbaseClient("couchbase"); | |
var randomKey = Guid.NewGuid().ToString(); | |
var randomData = Guid.NewGuid().ToString(); | |
//add a random key with some random data | |
couchbaseClient.Store(StoreMode.Set, randomKey, randomData); | |
var getResult = couchbaseClient.Get(randomKey); | |
if (getResult == null || (getResult as string) != randomData) | |
{ | |
Console.WriteLine("Could not get data that I just set..."); | |
} | |
else | |
{ | |
Console.WriteLine("Successfully retrieved {0}", getResult); | |
} | |
//now flush the bucket | |
couchbaseClient.FlushAll(); | |
//now repeat the get | |
getResult = couchbaseClient.Get(randomKey); | |
if (getResult != null) | |
{ | |
Console.WriteLine("Got {0} data when expecting a cache miss", getResult); | |
} | |
else | |
{ | |
Console.WriteLine("Flush seemed to work"); | |
} | |
Environment.Exit(0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi. have you been found any solution for this? I can't flush too.