C # Distributed Cache Couchbase

Source: Internet
Author: User
Tags couchbase administrator password couchdb

C # Distributed Cache Couchbase use one, introduction

The Cache system most used by the C # industry today is mainly memcached and Redis. These two Cache systems can be said to be a more mature solution, but also a lot of system of course choice.

Memcache's development team has developed membase, supporting multiple server clusters, slicing and replicating data, effectively improving service stability and data security, and supporting persistent storage of data. But the stability of the code is not good enough. The Membase team then merged with the COUCHDB team to launch the two-in-product: Couchbase.

The biggest features of Couchbase:

1, fully inherit memcache, native support all memcache operation;

2, inherit the characteristics of Membase, support cluster and data persistence;

3, inherit the document nature of COUCHDB, support the operation of data through view. The feature of this view provides the convenience that Memcache previously did not have, but it is simple and primitive compared to MongoDB, it is not a function of universal demand.

Today, we also learn the simple use of couchbase.

Second, Couchbase service-side installation

Server: Http://www.couchbase.com/download Select the appropriate version of the system to download and install. Currently the latest 4.0.0.

Couchbase Web-based management, after installation, if successful, then you can see in the browser. If you do not have to do so manually access http://localhost:8091/index.html. This machine can be installed with localhost, can use IP or hostname.

On the page that opens, click Setup, default settings, then click Next, and then go to the following

Enter the administrator password. Proceed to next and finalize the configuration to enter the homepage. There are a lot of things to look at in there.

After installation, you can also check the service to see:

Second, the client calls

Create a console application for testing and then couchbase the client's DLL installation through NuGet. My project is based on. NETFramework4.0, so choose Couchbasenetclient 1.3.12.

The reference is complete, the default connection address is: Http://127.0.0.1:8091/pools/default, code code for a simple call:

1 static void Main (string[] args) 2         {3             //Configuration Server    4             couchbaseclientconfiguration cbcc = new Couchbaseclientconfiguration (); 5             //Set various timeout times    6             cbcc. Socketpool.receivetimeout = new TimeSpan (0, 0, 2); 7             CBCC. Socketpool.connectiontimeout = new TimeSpan (0, 0, 4); 8             CBCC. Socketpool.deadtimeout = new TimeSpan (0, 0, 10); 9             //Use the default database   of             CBCC. Urls.add (New Uri ("Http://127.0.0.1:8091/pools/default"));             //Create a client, load the client configuration             Couchbaseclient client = new Couchbaseclient (CBCC);             add a data to             casresult<bool> casresult = client. Cas (Storemode.add, "Test", "Hello world!");             get the data you just added             . Console.WriteLine (client. Get ("Test"));             Console.WriteLine ("Done!") ");             console.readline ();         

The difference between Storemode.add, Storemode.replace and Storemode.set

Add: Indicates the addition of a new key;

Replace: Indicates that an existing key is updated;

Set: Indicates that if key does not exist, it is added, the update is present.

Couchbaseclient is added (Cas), removed (remove), and other methods, pending further study.

The cache value results for the first run run get settings are:

Here is a comment on the value of this sentence: casresult<bool> casresult = client. Cas (Storemode.add, "Test", "Hello world!");

Run the value again or get it:

Other test results:

The Web backend can also see the added data, and it has been encrypted:

Iii. Summary

Easy to use down the feeling is very good, have time to continue to study. Here is a Couchbase installation configuration and instructions for use.

  c# Distributed Cache Couchbase Usage Summary: First, the current C # industry most used cache system is mainly memcached and Redis. These two Cache systems can be said to be a more mature solution, but also a lot of system of course choice. Memcache Development team developed Membase, support multiple server clusters, data slicing and replication, effectively improve the service stability and data ... Read the full text posted @ 2015-09-20 19:30 weixiao520 Read (2319) |  review (+)   edit  asp.net MVC5 and EF6 Learning Series Summary: Recently learned to use MVC5 and EF6, blog Park Search, write down this article record, in order to learn to use. I. ASP. NET MVC5 website development @ dongting Glow Writing Blog Series ASP. NET MVC5 Website Development Practices-Overview ASP. NET MVC5 Web site development Practices (i)-Project framework ASP. NET MVC5 Website Development Practices (i)-... Read the full text posted @ 2015-09-14 16:28 weixiao520 Read (1311) |  Comments (8)   Edit  c# Reflection mechanism Summary: recent project use to reflection, Find a previously reserved document, the author is Li Zhiwei, can not find the original source, here to express thanks. Share it here. 1. Reflection mechanism Basic Class (1) The function of the reflection mechanism is called reflection, and the ability to review metadata and collect type information about it. Metadata (the most basic data unit after compilation) is a whole bunch of tables, and when the assembly or module is compiled, the compiler creates a class definition table ... Read the full text posted @ 2015-05-22 17:22 weixiao520 read (262) |  Comments (0)   Edit   Brief summary of Close () and Dispose () in C #:. NET has many classes that provide the close () and Dispose () methods, and I've always thought that they are one thing and are exactly equivalent, anywhere, with one. Some classes say that Close is more user-aware than dispose of (such as closing a connection, closing a stream), so this makes me feel that close is another way to use it as a dispose of, which would have just a disp ... Read the full posted @ 2014-01-26 14:53 weixiao520 Reading (351) |  Comments (1)   Edit data type correspondence when calling Windows APIs in  c# Summary: When you recently made a WinForm project, you call the Windows API. Check out some information, data type correspondence is organized as follows Bool=system.int32 Boolean=system.int32 byte=system.uint16 char=system.int16 colorref= System.UInt32 dword=system.uint32 dword32=system.uint32 Dword64=system.uint64 float=system.float HACCEL= System.IntPtr handle=system.intptr hbitmap=system.intptr Hbrus Read the full text posted @ 2014-01-26 14:34 weixiao520 reading ( 589) |  Reviews (0)   Edit   Implement a summary of the use of a CheckBox column in a DataGridView control: Recently done WindowsForms program, when using the DataGridView control, add a column to do the selection, Discovery checkbox cannot be selected. After the search, to implement the DataGridView CellContentClick event, paste the code: 1///2///Implement DataGridView Control in the use of the checkbox column 3//... Read the full text posted @ 2014-01-20 11:56 weixiao520 Read (337) |  Comments (0)   Edit  c# Simple Learning Regular Expression summary: The first step is to introduce a regular namespace: usingSystem.Text.RegularExpressions; The second step constructs a regular expression object with the specified regular form, and the following regular is used to search for a A-Z letter of length 10: Regex obj =newregex ("[A-z]{10}"), and finally, according to the positive ... Read the full text posted @ 2013-11-26 23:12 weixiao520 Read (334) |  Comments (0)   Edit  dotnetzip Encapsulation class Summary: DoTnetzip is an open source class library that supports. NET in any language, it is easy to create, read, and update zip files. And can also be used in the. The Netcompact framework. Here: http://dotnetzip.codeplex.com/downloaded to the package has a lot of DLL files, general reference Ionic.Zip.dl ... Read the full text posted @ 2013-10-12 16:48 weixiao520 Read (1015) |  Comments (2)   Edit  newtonsoft.json Date Conversion Summary: When using Easyui to do the background, the table DataGrid is used, and the time is displayed as 2013-06-15t00:00:00 form when converted to JSON format with Newtonsoft.json. Later, we studied the Newtonsoft.json, when using the Newtonsoft.json conversion, such as the object with date when converting. The code is as follows: newtonsoft.json.converters.isodatetimeconvertertimeconverter= NewNewtonsoft.Json.Converters.IsoDateTimeConverter (); timeconverter.datetimeformat= "yyyy read the full text posted @  2013-06-19 13:22 weixiao520 Read (351) |  Comments (0)   Edit Category:  c#

C # distributed Cache Couchbase

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.