Install service side
Server-Side Download address: Http://www.couchbase.com/download Choose the suitable for their own download installation on it, I chose here is Win7 64.
In the installation service side if the error shown below, I encountered during the Win7 64 installation.
This time you can first undo the installation. Run regedit through the cmd command. Expand the hkey_local_machine\software\microsoft\ windows\ CurrentVersion Branch and locate the key value named "ProgramFilesDir" in the right-hand area of the window, with its original key value "C:\" Program Files to "X:\Program files", close the registry.
I modified the time e disk, because I have a lot of space left in e-disk.
When the server is finished installing, if it succeeds, you can see it in the browser. If you do not then need to manually access http://localhost:8091/index.html. I am installed on this machine so can use localhost, can use IP or hostname.
Click Setup, default settings, then click Next,next,next, then go to the following
Simply enter the basic information and continue with next.
Here I enter password 123456, continue next, finalize the configuration arrival page.
Of course, after installation can also be viewed in the service.
Client Calls
Create a console application and install it through NuGet.
After the reference, compile the project and see the referenced DLL file
The reference is complete by code for a simple call
Copy Code code as follows:
Using Couchbase;
Using Couchbase.configuration;
Using Enyim.caching;
Using Enyim.Caching.Configuration;
Using Enyim.Caching.Memcached;
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Namespace Memcachedtest
{
Class Program
{
static void Main (string[] args)
{
Configuring the server
var mbcc = new Couchbaseclientconfiguration ();
Set various timeout times
mBCC. Socketpool.receivetimeout = new TimeSpan (0, 0, 2);
mBCC. Socketpool.connectiontimeout = new TimeSpan (0, 0, 4);
mBCC. Socketpool.deadtimeout = new TimeSpan (0, 0, 10);
Use the default database
mBCC. Urls.add (New Uri ("Http://127.0.0.1:8091/pools/default"));
Build a client, load the client configuration
var client = new Couchbaseclient (MBCC);
Add a piece of data
var item = client. Cas (Storemode.add, "Test", "Hello world!");
Get the data that you just added
Console.WriteLine (client. Get ("Test"));
Console.WriteLine ("Done!") ");
Console.ReadLine ();
}
}
}
The cache value for the first run get settings is definitely fine.
Now we're going to comment on this set of values.
Copy Code code as follows:
var item = client. Cas (Storemode.add, "Test", "Hello world!");
The modified code is as follows
Copy Code code as follows:
Configuring the server
var mbcc = new Couchbaseclientconfiguration ();
Set various timeout times
mBCC. Socketpool.receivetimeout = new TimeSpan (0, 0, 2);
mBCC. Socketpool.connectiontimeout = new TimeSpan (0, 0, 4);
mBCC. Socketpool.deadtimeout = new TimeSpan (0, 0, 10);
Use the default database
mBCC. Urls.add (New Uri ("Http://127.0.0.1:8091/pools/default"));
Build a client, load the client configuration
var client = new Couchbaseclient (MBCC);
Add a piece of data
var item = client. Cas (Storemode.add, "Test", "Hello world!");
Get the data that you just added
Console.WriteLine (client. Get ("Test"));
Console.WriteLine ("Done!") ");
Console.ReadLine ();
Run the value again or get it.