3、telnet简单测试
[root@a ~]# telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
add testkey 0 20 1 缓存一个键testkey,序列0 缓存时间20S 1字节
x 值为x
STORED
get testkey 请求testkey
VALUE testkey 0 1
x 值为x
END
get testkey 20秒后再次请求,就没有值了
END
4、为php安装memcache插件
1.安装memcache插件
#tar xf memcache-2.2.7.tgz
#cd memcache-2.2.7
#phpize
#./configure --with-php-config=/usr/bin/php-config
# make && make install(安装完成会出现下方提示)
Installing shared extensions: /usr/lib64/php/modules/
2.配置php支持memcache
# vim /etc/php.ini
extension = "/usr/lib64/php/modules/memcache.so" 添加此行
# service httpd restart