2 days is a bit of a torment for me. When the amount of data reached 17w, I was very slow to execute queries locally!
Ask some of the PHP Daniel how to solve the speed problem, after adding the index and optimized SQL or slow! I decided to use memcached and memcache to deal with the win environment, first declare:
Memcache is the extension of PHP, memcached is the client, Complex said: Memcache module provides a convenient process-oriented and object-oriented interface memcached, memcached is to reduce dynamic Web applications A resident process cache product that results from loading data from a database.
Because I use the local XAMPP integration environment, in order to avoid the misunderstanding with everyone directly to the address and file steps list
Installation
Windows 64-bit Memcached:http://www.urielkatz.com/projects/memcached-win64/memcached-win64.zip
1. Installing Memacached.exe
①A new memcached folder under the C drive, unzip the download memcached to this folder
② Enter CMD in the beginning, locate the Cmd.exe program, right-click on it, and select "Run as Administrator"
③ Input: cmd c:/memcached
④ Input: memcached.exe-d Install//installation memcached
⑤ Input: memcached.exe-d start//Startup memcached
2. Install Php_memcached.dll my local environment uses XAMPP is 32-bit x86
① to the back of the page to download Memcache.dll http://pecl.php.net/package/memcache/3.0.8/windows
To download a DLL file that is consistent with your own software integration pack version, such as: ① your xampp is 32-bit, you will need to download x86 ②phpinfo () in the show thread Safety (thread safe): enabled you need to download ts otherwise, download nts
② Copy the downloaded DLL file to the. Under the/php/ext directory
③ adding Extension=php_memcache.dll in php.in
④ Restart apace
3. Using Memcahe
$mem = new Memcache;
$mem->connect ("127.0.0.1", 11211);
$mem->set (' key ', ' Hello memcached! ', 0, 60);
$val = $mem->get (' key ');
Echo $val;
Output: Hello memcached!, the installation is successful, you can use Memcached
Here is the usage of memcached in YII2
$memcached = Yii:: $app->cache->add (' Sex ', ' nan ');
$memcachedGet = Yii:: $app->cache->get (' sex ');
Echo $memcachedGet;
Finally, if the page output:Hello memcached! Congratulations on your installation success!
This article from "Kangjunfei" blog, reproduced please contact the author!
About win under memcached installation steps