天天看點

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,如需轉載請自行聯系原作者