MEMCACHE is used as PHP SESSION HANDLER

Source: Internet
Author: User

After installing the memcache module for php, check the description file of the module and find that it can also be used directly as the php session handler without additional encoding.

The setting method is simple. You only need to modify the values of the following keys in php. ini:

Session. save_handler = memcache
Session. save_path = 'tcp: // 192.168.0.1: 8080'

# Separate multiple IDs with commas (,).
To test whether memcache is used, obtain the PHPSESSID and use memcach as the KEY to read it.
Benefits of using memcache for php session handler


Use memory to store session information, without going through disks, databases, etc., which is fast
Multiple machines can share one or more memcached servers to share session information among multiple machines, facilitating session problem handling in multi-machine clusters.
...
Disadvantages of using memcache as php session handler

First, memcached services must work normally, otherwise php session-related functions will not work, so that php processing will have an additional layer of external dependencies.
Because memcached uses memory, when the number of users is large, it may cause session length problems due to memory reasons, the actual session failure duration is less than the preset failure duration (determined by the processing mechanism of memcached with insufficient memory)
Because of memcached's memory management mechanism, when the data stored in the session exceeds 1 MB, there is a data loss problem (but generally, no one will store so much information in the session ).
...
Determine whether to use memcache as the php session handler in the actual environment based on the above situations.

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.