Under Windows configuration using memcached

Source: Internet
Author: User
Tags failover memcached manager

    • Tools:
      • Memcached-1.2.6-win32-bin.zip memcached Service-side program (for Win)
      • Memcached manager Win's Memcached management tool
      • Memcached. NET client Library c#/.net Memcached clients DLL
    1. Installation Configuration memcached Service side
      1. Download Memcached-1.2.6-win32-bin.zip, extract Memcached.exe, is memcached the main program. For example, we put it under C:\Program files\memcached under the memcached server.
      2. Download and install Memcached Manager to manage the memcached server.

        Open memcached Manager and click Add Server to fill in the server information. I have installed the memcached directly here locally. , click Apply after filling, the server will appear on the right side of successful words.

        Click Add instance to append the memcached instance. Here are some configuration information. Ip, port, memory and so on, not explained. Click Apply will prompt you to start now, we choose here is

        After success found that there are already instances on the right side, to this server configuration is complete.

    2. Client Calls
      1. The first thing you need to do is download the memcached. NET client Library, unzip it to get a memcacheddotnet directory, a bunch of files.

      To test memcached, we build a Web project. Reference Memcached.ClientLibrary.dll, this dll in Memcacheddotnet\trunk\clientlib\src\clientlib\bin\2.0\release

      1. Use is relatively simple, 1 storage, 1 fetch. Let's simply get two pages.

        Plus using

Using Memcached.clientlibrary;

Save:

Code:

protected void Page_Load (object sender, EventArgs e)

{

if (! IsPostBack)

{

String[] serverlist = {server. Text};

Sockiopool pool = sockiopool.getinstance ();

Pool. Setservers (serverlist);

Pool. Initconnections = 3;

Pool. Minconnections = 3;

Pool. MaxConnections = 5;

Pool. socketconnecttimeout = 1000;

Pool. Sockettimeout = 3000;

Pool. Maintenancesleep = 30;

Pool. Failover = true;

Pool. Nagle = false;

Pool. Initialize ();

}

}

protected void Setvalue_click (object sender, EventArgs e)

{

memcachedclient mc = new Memcachedclient ();

Mc. EnableCompression = false;

Mc. Set (Key.text, Value.text);

Response.Write ("<script>alert (' OK ') </script>");

}

Take:

Code:

protected void Getvalue_click (object sender, EventArgs e)

{

String[] serverlist = {server. Text};

Sockiopool pool = sockiopool.getinstance ();

Pool. Setservers (serverlist);

Pool. Initconnections = 3;

Pool. Minconnections = 3;

Pool. MaxConnections = 5;

Pool. socketconnecttimeout = 1000;

Pool. Sockettimeout = 3000;

Pool. Maintenancesleep = 30;

Pool. Failover = true;

Pool. Nagle = false;

Pool. Initialize ();

memcachedclient mc = new Memcachedclient ();

Mc. EnableCompression = false;

String value = (String) mc. Get (Key.text);

Value.text = value;

}

Look at the effect:

Click Add to save to memcached

Point get. Get the results.

Transferred from: http://www.cnblogs.com/weberypf/archive/2011/02/18/1957937.html

Under Windows configuration using memcached

Related Article

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.