Memcache study notes for php

Source: Internet
Author: User
This article provides a detailed analysis of Memcache in php. For more information, see 1. install memcached-d install in Windows
Start memcached-d start in Windows
Disable memcached-d stop

1_1, three methods to access memcache
Memcache
Memcached
Php (not dependent on extended socket operations)

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

; Enable memcache extension
Extension = php_memcache.dll

3. the server starts the memcached service.

4. define classes in PHP,
Create the Person. class. php file
In the file in use, require "Person. class. php" introduces the definition

5. multiple php Data types can be stored and obtained in Memcache
// String int float boolean array object (serialized) null resource (for example, mysql connection cannot be put into memcache)

How to store resources can be used as a connection pool.

6. memcache/session/cookie has different scopes.
In each browser, the cookie stores the product that accessed the site and browses the product,
Session is associated with a file on the web server to save logon information. Each user can only access its own session.
Solutions for collecting statistics on online users (when the database is unavailable:
Solution 1: traverse the number of session files
Solution 2: memcached shared cache (recommended)

7. The system uses multiple memcache systems (multiple distributed storage systems) to balance multiple memcached servers.

8. core technologies for large websites
1) Static page
2) cache (memcache ////)

8-1. memcached features
1. it is a c/s architecture that uses simple text for communication. Can be accessed by multiple clients
2. libevent-based event processing (java needs to handle various listeners by itself, but php does not listen much)
3. memory-based cache for faster speed.
4. distributed based on customers.

9. write your own cache system with reference to various memcache processes !!!!

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.