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.