Couchbase Server---Enyim.Caching.dll

Source: Internet
Author: User
Tags couchbase

This article does not intend to copy the official or to cite other people's descriptions of couchbase, just a little understanding of it (the error, please note), and attach an introductory example.

An ASP. NET Web project (same as other web development platforms) when the application is small, it can be cached using the caching mechanism that comes with it, however, when the project application scale is big, then the perpetual application goes on, I am afraid it will be difficult to achieve good results. and C # itself is an application-level development language, which specializes in business logic development, and the cache of this kind of business with a small degree of less close to the system, with C # development, obviously does not have a cross-platform, no universality, and C # on the cache also basically stay in Microsoft, we have what stage, and the efficiency is relatively low. Therefore, the use of C, C + + and other system-level development language to develop into a suitable choice.

Specific to the couchbase, I think it should be memcached, Membase, couchdb Fusion upgrade version, can be said to be a collection of the long, the current should be the most advanced cache system. The emergence of this system will greatly promote the development of various web development platforms and their own, really exciting.

Well, here's an example of how successful you've just been.

Download the Couchbase server version first and download the 2.5.1 Enterprise Edition yourself.

After the installation is successful, the local 8091 Port is officially opened for Web management by default.

This is the memory usage and the cache is being mobilized.

This is the usage of the cache bucket.

The following is an example of a simple invocation of reference data, which looks first:

In the User Name text box, enter the cached user name and click the "Cache User" button to display the screen.

This is the screen that appears when you click the "Getcacheduser" button when the cache is successful.

Here is the Code section:

The calling code needs to use the Couchbase client, after downloading, in the project reference: Cachebase.dll and Enyim.Caching.dll, after which the following nodes are configured in Web. config

  <configSections>    <!--for more information on Entity Framework configuration, visit/HTTP// go.microsoft.com/fwlink/? linkid=237468    --<section name= "Couchbase" type= "Couchbase.Configuration.CouchbaseClientSection, Couchbase "/>  </configSections>  <couchbase>    <servers bucket=" Default " Bucketpassword= "" >      <add uri= "Http://127.0.0.1:8091/pools"/>    </servers>  </ Couchbase>

Foreground code (HTML) Section:

<div id= "Body" style= "text-indent:10px" >    name: <input type= "text" id= "Cacheuser"/> <input    type= "Button" value= "Cache User" onclick= "Cacheuser ()"/>    <input type= "button" value= "Getcacheduser" onclick= " Getcacheduser (); "/></div><script type=" text/javascript ">    function Cacheuser () {        $. Getserverjson (' Api/homeapi/getcacheuser ',            {userName: $ ("#cacheuser"). Val ()},            function (result) {                alert (result);            });    function Getcacheduser () {        $.getserverjson (' Api/homeapi/getcacheduser ',            {userName: $ ("#cacheuser"). Val ( )},            function (result) {                alert (result);            });    </script>

The C # code section is as follows:

public string Getcacheuser (string userName)        {            var client = couchbasemanager.instance;            Client. Remove (userName);            BOOL result = client. Store (Storemode.add, UserName, "I am:" + userName + ", what do I need?" ", Logintimespan);            return result = = true? "The cache was successful. ":" Cache failed! ";        }        public string Getcacheduser (string userName)        {            var client = couchbasemanager.instance;            Object OB = client. Get (userName);            return OB = = null? "Sorry, I didn't find this person!" ": OB. ToString ();        }

Couchbase Server---Enyim.Caching.dll

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.