天天看点

memcached笔记

memcached命令率=git_hits/curr_items

查看memcached状态

memcached-tool 服务端IP:服务端端口 stats

echo stats |nc 服务端IP 服务端端口

memstat --servers=服务端IP:服务端端口

创建数据和查看数据

set key2 0 30 2

说明;30是过期时间(如果设置成0,代表永不过期);2是字符长度;0是flags的标记(一般是开发的定义来创建)

set在没有对应的key时候就增加,有的就覆盖

add是增加key,存在的是失败

导出和导入(因为memcached是把数据缓存在内存中,在重启服务或者是重启机器前做备份)

导出

memcached-tool 服务端IP:服务端端口 dump > xxx

导入

nc 服务端IP 服务端端口 < xxx

php的memcache模块

php7的memcache模块

unzip pecl-memcache-php7.zip

cd pecl-memcache-php7

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache

make && make install

memcached笔记

     本文转自wsw26 51CTO博客,原文链接:http://blog.51cto.com/wsw26/2059230,如需转载请自行联系原作者