About win under memcached installation steps

Source: Internet
Author: User
Tags yii

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

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.