PHP memcache and memcached extension differences

Source: Internet
Author: User
Tags php memcached

Laosheng a long conversation. I'll tidy it up here.

Memcache's document in: Http://pecl.php.net/package/memcache

Memcached's document in: http://pecl.php.net/package/memcached

First look at the time, Memcache was first developed in February 2004, the last update is in April 2013, and Memcached was first developed in January 2009, the last update is in January 2014 updated. So Memcache's history is earlier than memcached.

Installing the memcache extension does not require the installation of other things, but in the installation of memcached will require you to install libmemcached, the problem, libmemcached is the C client of Memcache, it has the advantage of low memory, Line Cheng and other characteristics. such as Sina Weibo before the full memcache of PHP to replace the PHP memcached, in high concurrency, stability decisively improved.

List of Memcache methods in: Http://cn2.php.net/memcache

List of memcached methods in: http://www.php.net/manual/zh/book.memcached.php

Memcache methods are particularly rare, such as getmulti,setmulti are not, basic left the simplest get and set. So "memcached than memcache to support more memcache protocol."

Then memcached directly configured the session support, as long as a slight modification of the configuration file can be stored in the session memcache.

See a lot of people commented that this article is not used, first omitted. Can not look.

It was 2011 when I wrote this, and 3 years passed. Many people read the article, made a comment, criticized me also hurt me, write article sharing, but also misleading, but different people look at the effect of altogether is different.

So this article first omitted first. Here I emphasize the following:

In fact, the difference between the 2

First, this article is about the difference between the 2 memcached clients on a PHP client. And now the main use is the memcached client extension.

Two different versions of PHP's memcached client
New Memcache is the PECL extension library version
New memcached is the libmemcached version

Second, for outdated things, will always be replaced by new things, why not new things?

This article is written very clearly, the principle of the procedure to understand first, tangled in this thing called what is the meaning of the name? First you have to understand the principle!

Check out the wiki first.

Https://code.google.com/p/memcached/wiki/NewStart

http://www.php.net/manual/en/book.memcached.php

http://www.php.net/manual/en/book.memcache.php

It is also stated that the elder brother 3 years ago is also small white ..... Is that a little white? Small White said little white .... Hey......

-------------------------------------------------Split Line----------------------------------------------------------- --------------------

With a period of time Memcache and memcached summarized under the understanding, see a lot of people in the cache, just did not make clear memcache and memcached differences, there is the use of the time is basically get/set After using the memcached can actually find out how good the Getmulti/setmulti is, this article write those who just use the memcache cache, the new veteran, please skip.

There is no need to say more about memcached, which is a distributed memory object caching system. Since it is a system used to store things, then must have a place to store it, we call it server-side bar, and then who put things in the above call it client bar, that how to put it, it must be the client--Connection server--to send things to the server side-to achieve the storage of things, It's the same when you're going to fetch it, connect first, and get back. All have memcached server side, installation please see http://www.cnblogs.com/scotoma/archive/2010/05/27/1745011.html this is win under, *unix under the please to http:/ /memcached.org/to download and then compile the installation, here I do not say that the installation of the configuration, the Internet has been a lot.

After the installation is finished, look at the process inside Memcached is the service running? Okay, the process is running, so just look at the client.

I do PHP development, all installed PHP client extension, there are memcache and memcached expansion of 2 kinds, installation I do not say to do it myself, after the installation is completed Phpinfo will find the following page shows that your expansion installation succeeded, If you do not succeed, please check the php.ini inside the correct configuration

Both the server side and the client are ready to see if the sample code can run,

Results

All run up, look at the difference between the use of Memcache and memcached, then look at the PHP manual, actually the handbook is the best thing

Methods of Memcache Extension

Methods of memcached Extension

Completed, in fact, 2 can be understood as 2 expansion of historical reasons do not want to say more, is to use memcached, but also some very strange bugs, For example, using the memcached extension of the session of the appropriate settings (session stored in the memcached, using the memcached extension stored will be found will not expire).

In practice after the use of what you will know and what, hands is the best way to learn.

Reference article:

http://www.ttlsa.com/memcache/memcache-and-memcached-php-php-and-problems/

Http://www.cnblogs.com/scotoma/archive/2011/02/15/1955573.html

PHP memcache and memcached extension differences

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.