I have been using the new software package manager, which is quite good. Now I want to try out memcache for Ubuntu. Of course, I don't know a lot of usage. I just want to test it first and set up the environment first, again slowly familiar with the need for memcahced, php5-memcache in the new lide search memcache these two files have, will also attach the need for libevent is also well, and then put php. extension = memcache is added after ini. so restart apache and enter
I have been using the new software package manager, which is quite good. Now I want to try out memcache for Ubuntu. Of course, I don't know a lot of usage. I just want to test it first. I will first build the environment and then become familiar with it.
Need memcahced, php5-memcache in the new lide search memcache these two files have, will also attach the need for libevent is also well,
Add extension = memcache. so to php. ini.
Restart apache. In the command window, enter
/Usr/bin/memcached-d start
Of course, you need to know where memcached is. OK, write the test file and test it.
$ Mem = new Memcache;
$ Mem-> connect ("127.0.0.1", 11211 );
$ Mem-> set ('key', 'This is a memcached test! ', 0, 60 );
$ Val = $ mem-> get ('key ');
Echo $ val;
Important
1. For large data blocks, the memcache client automatically compresses and uploads the data even if no compression mark is set during storage.
2. Data of the array type is first serialized into a string and then sent to the memcache server.
3. Use the get_class_vars function to convert data of the object type into an array and then serialize it into a string and upload it to the server.
4. The server only saves strings.