×i½uÒªÍaeMemcache£¬ËuÒÔÐeÒªWindows 64λÏ´i½¨MemcacheµÄ¿ª¢µ÷ÊÔ»¾³£¬¼Ç¼ÏÂ×Ô¼º°²×°´i½¨µÄ¹ý³Ì£¬*¢ÏÖ±ÈLinuxÖдi½¨¼oµ¥¶aÁË¡£
ÕaÀiÊÇÎÒÓÃWindows 7 64Bit°²×°MemcacheµÄ¹ý³Ì
1¡¢°²×°PHP¡¢MysqlÒÔ¼°Apache£¬Õa±ß»¾³ÎҾͲ»Óöa×o½eÉÜÁË£¬Ò»¼u»¾³Óкܶa£¬¼¸ºo²»Ó°ÏiMemcache¡££¨ÎÒ×Ô¼ºµÄµ÷ÊÔ»*¾³ÊÇPHPStudy£(C)
2¡¢ÏÂÔØ°²×°Memcache£¬ÎÒÕaÀiÏÂÔصÄÊÇ64λ°ae±¾¡£
ÏÂÔصØÖ*£º<http://www.jb51.net/softs/205839.html>
a£(C)ÏÂÔؽaѹ֮ºo*ÅÔÚÓ²Å̵ÄĿ¼Ï£¬È磺D:\memcached .
b£(C)È»ºoÔÚÔËÐÐÖÐÊaÈecmd½øÈeÃuÁiÐУ¬½øÈeµ½Memcached.exe ËuÔÚµÄĿ¼£¬ÀýÈ磺D:\memcached
c£(C)È»ºoÔÚMemcacheĿ¼£¬ÊaÈememcached.exe ¨Cd install£¬Ìi¼Ómemcached.exeΪ*þÎñ
d£(C)ÊaÈememcached.exe -d start£¬ÔËÐÐmemcached³ÌÐo¡£
C:\users\Test>d:
D:\>cd d:\memcache
d:\memcache>memcached.exe -d install
d:\memcache>memcached.exe -d start
Memcahed»u±¾ÉeÖòÎÊý£º
-p ¼aÌýµÄ¶Ë¿Ú£¨Ä¬ÈÏÊÇ11211£(C)
-l Á¬½ÓµÄIPµØÖ*, ĬÈÏÊDZ¾»u
-d start Æo¶¯memcached*þÎñ
-d restart ÖØÆðmemcached*þÎñ
-d stop|shutdown ¹Ø±ÕÕýÔÚÔËÐеÄmemcached*þÎñ
-d install °²×°memcached*þÎñ
-d uninstall жÔØmemcached*þÎñ
-u ÒÔµÄÉi*ÝÔËÐÐ (½oÔÚÒÔrootÔËÐеÄʱºoÓÐЧ)
-m ×i´oÄÚ´aeʹÓ㬵¥Î»MB¡£Ä¬ÈÏ64MB
-M ÄÚ´aeºÄ¾¡Ê±*µ»Ø´iÎo£¬¶ø²»ÊÇɾ³ýÏi
-c ×i´oͬʱÁ¬½ÓÊý£¬Ä¬ÈÏÊÇ1024
-f ¿e´oСÔo³¤Òo×Ó£¬Ä¬ÈÏÊÇ1.25
-n ×iС*ÖÅa¿Õ¼a£¬key+value+flagsĬÈÏÊÇ48
-h ÏÔʾ°iÖu
×¢£º¾ÊµÑeʹÓÃÃuÁiÐ޸Ķ˿ÚÎÞЧ£¬ÏaÓ¦µÄ½a¾o½°¸ÊÇÐÞ¸Ä×¢²a±iÀ´´iµ½Õa¸oÐ޸Ķ˿ںÍÅaÖõÄÄ¿µÄ¡£
ÎÒ×Ô¼ºÐ޸ĵÄÖµÈçÏ£º£¨×i´oÄÚ´ae´oС1024M£¬×i´oÁ¬½ÓÊý£º2048£¬IPµØÖ£º127.0.0.1£¬¶Ë¿ÚĬÈÏÊÇ11211£¬ÉuЧÐeÒªÖØÆoMemcached.exe*þÎñ£(C)
½øÈe×¢²a±iÕÒµ½HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server £¬ ÔÚÆaÖÐÓÐÒ»¸oImagePath Ïi£¬ÖµÎª"d:\memcached\memcached.exe" -d runservice £¬ÔÚºoÃae¼ÓÉÏ -l 127.0.0.1 -m 1024 -c 2048 ×iºoImagePath ÏiÖµÓ¦¸ÃÏñÕaÑu£º d:\memcached\memcached.exe" -d runservice -l 127.0.0.1 -m 1024 -c 2048
ʹÓÃtelnet²aÊÔÏÂmemcache£º
telnet 127.0.0.1 11211£¨×¢Òa£ºÕa±ßÐeҪʹÓÃÉeÖõÄIPºÍ¶Ë¿Ú£(C)
ÊaÈestats
3¡¢ÐÞ¸ÄPHP.iniÀ(C)Õ¹Ö§³Ömemcached¡£
ÏÂÔØphp_memcache.dll£¬ Çe×Ô¼º²eÕÒ¶ÔÓ¦µÄphp°ae±¾µÄÎļþ¡£ÎÒ×Ô¼ºÓõÄPHPstudyµÄÒ»¼u»*¾³ÄÚ×Ô´ømemcached.dllÎļþÁË¡£
Ö»ÒªÐÞ¸ÄÀ(C)Õ¹£¬¼ÓÉÏextension=php_memcache.dll
4¡¢ÖØÐÂÆo¶¯Apache£¬È»ºo²e¿´Ò»ÏÂphpinfo£¬Èç¹uÓÐmemcache£¬ÄÇô¾Í˵Ã÷°²×°³É¹¦
5¡¢¼oµ¥²aÊÔmemcacheÔËÐÐ
<?
$memcache = new Memcache;
$memcache->connect("127.0.0.1",11211);
echo "Server's version: " . $memcache->getVersion() . "<br />\n";
$memcache->set('key', 'This is a test!', 0, 60);
$val = $memcache->get('key');
echo $val;
?>
ÔËÐкo³oÏÖ£º
Server's version: 1.4.2
This is a test!