默认memcache会监听11221端口,如果想清空服务器上memecache的缓存,大家一般使用的是:
telnet localhost 11211
flush_all
同样也可以使用:
echo “flush_all” | nc localhost 11211
使用flush_all 后并不是删除memcache上的key,而是置为过期

安装memcached

wget http://memcached.org/files/memcached-1.4.24.tar.gz
tar -zxvf memcached-1.4.24.tar.gz
cd memcached-1.4.24
./configure && make && make test && sudo make install

memcached启动
/usr/local/bin/memcached -d -m 50 -u root -p 11211 -c 1024 -P /tmp/memcached.pid

memcached终止
kill `cat /tmp/memcached.pid`

http://www.cppblog.com/kefeng/archive/2010/10/11/129422.html

安装 memcached扩展

wget https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz

tar -zxvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure
make
make install

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make
make install

libmemcached 默认安装在/usr/local/,头文件安装在/usr/local/include/libmemcachde/,动态库默认安装在/usr/local/lib/下。

wget pecl.php.net/get/memcached-2.2.0.tgz
tar -zxvf memcached-2.2.0.tgz
cd memcached-2.2.0
whereis phpize
/usr/bin/phpize && ./configure –with-php-config=/usr/local/php/bin/php-config –enable-memcache=/usr/local/include/libmemcached –disable-memcached-sasl && make && make install

[memcache]
extension_dir=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
extension=”memcache.so”