Distributed Cache Beit Memcached Introduction

Source: Internet
Author: User
Tags memcached server memory server port

Distributed Cache Beit Memcached Introduction

Perhaps you have not used distributed cache, in the case of a Web cluster, it can be very good for some of the common data Resident server memory without worrying about the different steps of the web.
Here's a little bit about beitmemcached support for. NET, official reference
http://code.google.com/p/beitmemcached/

A complete sequence of operations:
1, click on the page above the downloads, put Memcached_1.2.5.zip and beitmemcached_source_2008_05_31.zip two compression package down.
2, decompression Memcached_1.2.5.zip, it is the server side of memcached.
3. Copy the memcached_1.2.5 to the computer you specified as the cache server, for example, called 192.168.0.1.
4, cmd run similar command ' d:\memcached\memcached.exe-d Install ' installation Server side, this time it should appear in the Windows service
5, cmd run similar command ' d:\memcached\memcached.exe-d start ' to start the service, see if there is a memcached process in the server process.
6. Confirm that server port 11211 is open (in firewall settings), otherwise the machine cannot access
7, the server side has been installed at this time, testing on other machines, cmd input telnet 192.168.0.1 11211 see if you can log in.

8. Unzip Beitmemcached_source_2008_05_31.zip, which is a client developed by. NET 2.0, which is full of source code and an example of invocation.
9, with the corresponding version of the VSS open the project, if interested in slowly study the code, not interested in choosing to generate a class library, compile a BeITMemcached.dll out.
10, create a new console program, reference BeITMemcached.dll, enter similar code test

Using System;
Using Beit.memcached;
Namespace ConsoleApplication3
{
Class Program
{
static void Main (string[] args)
{
Memcachedclient.setup ("Testcache", new string[] {"192.168.0.1"});
Memcachedclient cache = memcachedclient.getinstance ("Testcache");
Cache. Sendreceievetimeout = 5000;
Cache. Minpoolsize = 1;
Cache. Maxpoolsize = 5;
Cache. Set ("Jinjazz", "scissors");
Object obj = cache. Get ("Jinjazz");
Console.WriteLine (obj);
Console.read ();
}
}
}

An example of a distributed cache is just as easy as operating Hashtable.

11, check the cache running state, this you need to be familiar with some memcached basic commands
Enter Telnet 192.168.0.1 11211 on your machine first, enter Telnet
Input stats in the dark, will come out the following results, may be useful to you I added a comment
STAT PID 2928
STAT Uptime 139279
STAT Time 1216258406
STAT version 1.2.5
STAT Pointer_size 32
STAT Curr_items 4
STAT Total_items 6
STAT bytes 1052947
STAT Curr_connections 2
STAT Total_connections 10
STAT Connection_structures 4
STAT Cmd_get 13//Read 13 times
STAT Cmd_set 6//set 6 times
STAT get_hits 11//11 Hits
STAT get_misses 2//2 times failed
STAT Evictions 0
STAT Bytes_read 1053321
STAT Bytes_written 6279461
STAT limit_maxbytes 67108864
STAT Threads 1
END

12, the end.

Distributed Cache Beit Memcached Introduction

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.