Home > Backend Development > PHP Tutorial > php Memcached distributed cache (1/3)_PHP tutorial

php Memcached distributed cache (1/3)_PHP tutorial

WBOY
Release: 2016-07-20 11:09:15
Original
726 people have browsed it

1. What is memcached

memcached is a high-performance distributed memory object caching system for dynamic web App to reduce database tutorial load. It delivers the speed of dynamic, database-driven websites by caching data and objects in memory to reduce the number of database reads.

I believe many people have used cache, and it is also built-in in .net Caching mechanism, there are many third-party tools such as apache, nginx etc. can be used to cache static resources. At the same time, we can also develop our own caching mechanism to cache database query data to reduce frequent operations on the database. But many times we always feel that these caches are always unsatisfactory. memcached can solve a lot of your troubles. At least it solved a lot of my problems in my study, so I decided to record it and share it.

memcachedhashmap/ value pair 🎜>. The daemon is written in c, but the client can be written in any language (This article uses c# as an example) and communicates with the daemon via the memcached protocol. But these things may be too advanced, so we won’t study them for now.

2. Distributed Cache

In fact, memcached is a distributed cache data service, but each service does not communicate with each other at all. This may be a little different from the distributed one I understand. It may be due to my lack of knowledge, or it may be everyone’s thinking. The angle of the problem is different. memcached The client uses a distributed algorithm to save data to different memcached servers and cache the data. Distributed cache, it can be known that memcached can cache large amounts of data. This can make up for the problem that many of us have encountered before: caching data on the application server, and only a small amount of data can be cached, otherwise the impact on the application server will be very large.
memcached
Application Mechanism Diagram:

This picture is a bit crude, but the problem can still be described clearly. The basic principle of the caching mechanism is to first query the data and save it to memcached. The address is in This request fetches data directly from the memcached cache, thus reducing the request pressure on the server.

1 2 3

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444808.htmlTechArticle1. What is memcached memcached is a high-performance distributed memory object caching system for dynamic web applications. Reduce database tutorial load. It works by caching data in memory and...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template