Use of Memcache

Source: Internet
Author: User

What is Memcache?

Memcache is a high-performance distributed memory object caching system that can be used to store data in a variety of formats, including images, videos, files, and database retrieval results, by maintaining a unified, huge hash table in memory. The simple thing is to call the data into memory and read it from memory, which can greatly improve the reading speed (from 36,000 section)

It is equivalent to a memory database that can reduce operations on the database.

It was initially seen in a PHP interface server in the company.

Installation:

How to install in Ubuntu: Digging pits (the next time you fill in the procedure forgot)

Apt-get Install memcached

After installation.

sudo memcached start start

/ETC/MEMCACHED.CONF is the default configuration file

-P Listening Port
-L connected IP address, default is native
-D Start memcached service
-D Restart Restart memcached service
-D Stop|shutdown Close the running memcached service
-D Install memcached service
-d Uninstall Uninstall memcached service
-U Run as (only valid when running as root)
-m maximum memory usage, in megabytes. Default 64MB
-M running out of memory and returning an error instead of deleting an item
-c Maximum number of simultaneous connections, default is 1024
-F Block size growth factor, default is 1.25-n minimum allocation space, key+value+flags default is 48
-h Display Help 2) Installing the Memcache client

PHP memcache Module Installation Method:

sudo apt-get install Php5-memcache

How to use: PHP manual with the use of the module instructions

Python: module https://pypi.python.org/pypi/python-memcached

Import Memcache mc = Memcache. Client ([' 127.0.0.1:11211 ']) mc.set (' Hello ', ' World ') mc.get (' Hello ')

Some notes:

Memcached does not have a security certificate, so if the configured-L listening IP is local to the IP may cause data security issues

Later with the familiar again pits

Use of Memcache

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.