"Memcache" Memcached

Source: Internet
Author: User
Tags memcached

I. Introduction of Memcached
1. Official website: http://www.memcached.org
2. Memcached is a free and open source, high performance, distributed memory object caching system.

Second, the role:
1. Store the data in memory and read from memory when needed.
2. The purpose of general use is to reduce the number of database accesses by caching database query results to improve the speed and scalability of dynamic Web applications.

3. Principle, if there is a cache, read the cache, if not, read the database.

Third, installation
Linux
Installation
1. Installing Libevent
Official website
http://libevent.org/
1. Unzip
TAR-ZVXF libevent-2.1.8-stable.tar.gz
2. Enter the catalogue
CD libevent-2.1.8-stable
3. Implementation
./autogen.sh
4. Configuration
./configure-prefix=/usr
5. Compiling the installation
Make && make install
2. Installing memcached
Official website
http://memcached.org
1. Unzip
TAR-ZXVF memcached-1.x.x.tar.gz
2. Enter the catalogue
CD memcached-1.x.x
3. One step to get it done
./configure && make && make test && sudo make install
Start
memcached-d-U root-p 11211

Installing PHP Extensions
1. Download
Https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
2. Unzip
Unzip Pecl-memcache-php7.zip
3. Enter the catalogue
CD PECL-MEMCACHE-PHP7
4. Executive Phpize
/usr/local/php/bin/phpize
5. Configuration
./configure--with-php-config=/usr/local/php/bin/php-config
6. Compiling the installation
Make && make install
7. Modify the php.ini configuration file
Quick location of php.ini and PHP extension directories
phpinfo,loaded Configuration File
Vim/usr/local/php/etc/php.ini
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20151012/"
Extension= "memcache.so";
8. Restart Apache
/usr/local/apache2/bin/apachectl restart
Iv. Working with PHP

1. Instantiation of New Memcache ()
2. Connect database Conncet (' localhost ', 11211)
Addserver (' Localhsot ', 11211);

3. Add (' name ', $value, memcache_compressed, 10);
Set (' Name ', $value, memcache_compressed, 10);

4. Remove delete (' name ');
Flush ();

5. Get get ();

"Memcache" Memcached

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.