<?php phpinfo ();? >
Check to see if PHP on your PC already has the Memcache extension installed.
If not:
(1) PHP Installation path Find ext folder
Mine is C:\wamp\bin\php\php5.5.12\ext.
Put the downloaded Php_memcache.all file in
(2) in the PHP.ini configuration file, add
Extension=php_memcache.dll
(3) Restart the server
I have a problem with the reference to the https://www.oschina.net/question/1254404_248665
With the Php_memcache-3.0.8-5.5-ts-vc11-x86.zip
Common functions:
For details, refer toPHP Manual "lxxxiv. Memcache Functions "this chapter.
Memcache Common object-oriented interfaces include:
Memcache::connect--Open a connection to Memcache
Memcache::p Connect--open a long connection to Memcache
Memcache::close--Close a Memcache connection
Memcache::set--Save data to the Memcache server
Memcache::get--Extract a data stored on the Memcache server
Memcache::replace--Replace an item that already exists on the Memcache server (functionally similar to memcache::set)
Memcache::d elete--delete a saved item from the Memcache server
Memcache::flush--Refreshes all items saved on the Memcache server (similar to deleting all saved items)
Memcache::getstats--Get the status of the current Memcache server running
Memcache::addServer--Distributed server add a server
<?php $mem =new Memcache; $mem->connect ("localhost", 11211); $mem->add ("MyStr", "This is a Memcache test!", memcache_compressed,3600);// $mem->set ("MyStr", " Wwwwwwwwwwwwwwwwwww ", memcache_compressed,3600); $str = $mem->get ("mystr"); echo "string:". $str. " <br> "; $mem->add ("Myarr", Array ("AAA", "BBB", "CCCC", "dddd")); Print_r ($mem->get ("Myarr")); Echo ' <br> '; Class person{ var $name = "Zhangsan"; var $age =10; } $mem->add ("myobj", new person); Var_dump ($mem->get ("MyObj")); $mem->close ();? >
Where to use Memcache in PHP
First, the database read out data (select) using memcache processing
Ii. use in Session control sessions
Memcache security (not accessible to others)
1. Intranet
2. Set up a firewall
php-using Memcache in PHP