Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

About the installation steps of Memcached under win

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Two days is a little hard for me. When the amount of data reaches 17w, my local query execution speed is very slow!

Ask some php Daniel how to solve the speed problem, after adding the index and optimizing sql, the speed is still slow! I decided to use Memcached and memcache to deal with it in the win environment, just to make it clear:

Memcache is the extension of php, memcached is the client, it is complicated to say: Memcache module provides convenient process-oriented and object-oriented interface for memcached. Memcached is a resident process cache product produced to reduce dynamic web applications loading data from database.

Because I use the xampp integrated environment locally, I directly list the address and file steps in order to avoid misleading you.

Installation

Windows 64-bit memcached download address: http://www.urielkatz.com/projects/memcached-win64/memcached-win64.zip

1. Install memacached.exe

Create a new memcached folder under ① c, and extract the download memcached to this folder

② type cmd in the beginning, find the cmd.exe program, right-click on it, and select "run as administrator"

③ input: cmd c:/memcached

④ input: memcached.exe-d install / / install memcached

⑤ input: memcached.exe-d start / / start memcached

two。 Install php_memcached.dll. I use xampp in my local environment. It's 32-bit x86.

① to the following page to download memcache.dll http://pecl.php.net/package/memcache/3.0.8/windows

/ / to download a dll file that is the same as the version of your software integration package, such as: ① your xampp is 32-bit, you need to download x86 ② phpinfo () showing Thread Safety (thread safety): enabled you need to download TS otherwise, download NTS

② copies the downloaded dll file to the.. / php/ext directory.

③ adds extension=php_memcache.dll to php.in

④ restart apace

3. Use memcahe

$mem = new Memcache

$mem- > connect ("127.0.0.1", 11211)

$mem- > set ('key',' Hello Memcachedhands, 0,60)

$val = $mem- > get ('key')

Echo $val

/ / output: Hello Memcachedware indicates that the installation is successful and memcached can be used.

/ / the following is the use 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 successful installation!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report