Home > Backend Development > PHP Tutorial > Memcache study notes for php_PHP tutorial

Memcache study notes for php_PHP tutorial

WBOY
Release: 2016-07-21 15:06:39
Original
746 people have browsed it

1. Install under win, memcached -d install
Start under win, memcached -d start
Close, memcached -d stop

1_1. Three ways to access memcache
memcache
memcached
php (does not depend on extended socket operation)

2. memcache extension (function) === access the cache system.
Install memcache extension (C compiled dynamic link library)

;Enable memcache extension
extension=php_memcache.dll

3. Start the memcached service on the server

4. Define the class in PHP,
create the file Person.class.php
require "Person.class.php" in the file used, and introduce Definition

5. Memcache can store and obtain multiple php data types
//string int float boolean array object (serialized) null resource (such as: mysql connection cannot be put into memcache)

How resources can be put in and used as a connection pool.

6. The scopes of memcache/session/cookie are different.
Cookie in each browser saves the product visited on the site and what has been browsed.
session A file on the web server is associated with the session and saves the login information. Each user can only access their own session.
Solution for counting online access users (when the database cannot be used):
Option 1: Traverse the number of session files
Option 2: memcached Shared cache (recommended)

7. The system uses multiple memcache systems (multiple to form distributed storage) memcache itself balances multiple memcached servers

8. Core technologies for building large websites
1) Page staticization
2) Caching (memcache////)

8-1. Characteristics of memcached
1. It is a c/s architecture and uses simple text for communication. Can be accessed by multiple clients
2. Based on libevent event processing (Java needs to handle various monitoring by itself, PHP does not monitor much)
3. Memory-based caching, faster.
4. Based on customer distribution.

9. Refer to the various processing of memcache and write your own cache system! ! ! !

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327602.htmlTechArticle1. Install under win, memcached -d install start under win, memcached -d start to close, memcached -d stop 1_1. Three ways to access memcache memcache memcached php (not dependent on extension so...
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