Install memcache in Ubuntu

Source: Internet
Author: User
I have been using the new software package manager, which is quite good. Now I want to try out memcache for Ubuntu. Of course, I don't know a lot of usage. I just want to test it first and set up the environment first, again slowly familiar with the need for memcahced, php5-memcache in the new lide search memcache these two files have, will also attach the need for libevent is also well, and then put php. extension = memcache is added after ini. so restart apache and enter

I have been using the new software package manager, which is quite good. Now I want to try out memcache for Ubuntu. Of course, I don't know a lot of usage. I just want to test it first. I will first build the environment and then become familiar with it.

Need memcahced, php5-memcache in the new lide search memcache these two files have, will also attach the need for libevent is also well,

Add extension = memcache. so to php. ini.

Restart apache. In the command window, enter

/Usr/bin/memcached-d start

Of course, you need to know where memcached is. OK, write the test file and test it.

$ Mem = new Memcache;

$ Mem-> connect ("127.0.0.1", 11211 );

$ Mem-> set ('key', 'This is a memcached test! ', 0, 60 );

$ Val = $ mem-> get ('key ');

Echo $ val;

Important

1. For large data blocks, the memcache client automatically compresses and uploads the data even if no compression mark is set during storage.

2. Data of the array type is first serialized into a string and then sent to the memcache server.

3. Use the get_class_vars function to convert data of the object type into an array and then serialize it into a string and upload it to the server.

4. The server only saves strings.

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.