Thursday, June 30, 2011

memcached 與 memcache比較及其它

除了結尾的一個d字差別外(有指結尾的d代表demand守護進程),因為名字混用引起混淆,今日在Debian5.0和Ubuntu10.04LTS試用後理解如下

memcached本身為一個服務守護進程,只有memcacheD没所講的memcache,獨立運行,類似apache server. 會接受客戶端如PHP擴展連線。

而php之下有兩個packges 一個名為php5-memcached 而另一個為php5-memcache,兩者角色一樣同為客戶端,功能略有不同可參考http://www.leonzhang.com/2011/06/24/memcached-vs-php-memcache/和php手冊
memcache http://www.php.net/manual/en/book.memcache.php
memcached http://www.php.net/manual/en/book.memcached.php

舊版Debian 5(backport sources.list) apt-cache 没有php5-memcached只有php5-memcache。相反較新的Ubuntu 10只有php5-memcached
Debian: ~# apt-cache search php5-memcached (有d)
没內容顯示

Debian5: ~# apt-cache search php5-memcache (没有d)
php5-memcache - memcache extension module for PHP5

Ubuntu10:~# apt-cache search php5-memcached
php5-memcached - memcached extension module for PHP5

dpkg -L php5-memcache 或dpkg --get-selections 查看已安裝軟件包

安裝
若要使用memcache,需完整安裝服務器memcached和php對應的客戶端(memcache與memcachd比較) 免混淆,皆加上php5-前綴
安裝server
apt-get install memcached

安裝php擴展
apt-get install php5-memcached

客戶端用法大致相同,會有d字之別,可參閱php手冊。

FAQ - Iterate all items - not design for
http://code.google.com/p/memcached/wiki/FAQ#Can_I_iterate_the_items_of_the_memcached_server?

wiki
http://code.google.com/p/memcached/wiki/NewStart

protocol
http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
https://github.com/trondn/memcached/blob/master/doc/protocol.txt
中英對照
http://www.jb51.net/shouce/memcached/index.html

一些memcache的特別注意地方
http://www.caiapps.com/memcached-for-load-balancing-sessions/
http://www.caiapps.com/duplicate-key-problem-in-memcache-php/

自訂session handler 用 memcache
http://www.keboola.com/blog/php-sessions-with-memcached-and-a-database-session-in-the-cloud-done-right/
Memcache(d) to store PHP sessions 比較php-memcache和php-memcached
http://beeznest.wordpress.com/2011/04/18/memcached-to-store-php-sessions/

替代品
http://www.mohawksoft.org/?q=node/8

14 comments:

Unknown said...

網上一例子用php5-memcache處理session,先測試Memcache::connect()是否成功,不成功則用回files 方式處理。但此種方式在php5-memcached並不湊效,因memcached中並没有connect(),只能通過Memcaced::addServer(),但一旦連接失敗,敗會出現
PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (127.0.0.1:11211) in Unknown on line 0
無法透過if 或者try{} catch 判斷而使用files方式儲存session
這又是兩者的另一區別

Unknown said...

what is difference between memcache.redundancy and memcache.session_redundancy?

memcache.redundancy is for stuff you store in memcached yourself with Memcache::add. memcache.session_redundancy is for PHP session data that's stored in memcached.

http://www.linkedin.com/answers/technology/web-development/TCH_WDD/616163-16662842

Anonymous said...

http://landvoicelearning.com/#97734 tramadol hydrochloride 50mg capsules side effects - buy tramadol online new zealand

Anonymous said...

buy tramadol tramadol overdose seizure - tramadol with tylenol

Anonymous said...

learn how to buy tramdadol tramadol for dogs human use - where to buy tramadol in usa

Anonymous said...

buy tramadol online tramadol hcl ultram 50 mg - tramadol online paypal

Anonymous said...

tramadol online tramadol 50mg tablets used - tramadol online no prescription overnight delivery

Anonymous said...

http://reidmoody.com/#96318 ativan dosage in seizure - ativan dosage hours

Anonymous said...

http://ranchodelastortugas.com/#72895 brand xanax online no prescription - xanax 2 mg gador

Anonymous said...

http://staam.org/#21236 buy tramadol online prescription - cheap tramadol no prescription overnight

Anonymous said...

buy tramadol online buy tramadol online usa cheap - tramadol online ireland

Anonymous said...

http://ranchodelastortugas.com/#50698 xanax drug interactions hydrocodone - xanax dosage insomnia

Anonymous said...

xanax price xanax japan - generic xanax side effects

Anonymous said...

Hey There. I discovered your blog the usage of msn. This is a very neatly written article.
I'll make sure to bookmark it and come back to learn extra of your helpful information. Thank you for the post. I will certainly return.

My web blog - website