刪除memcache值 flush memcached

來源:互聯網
上載者:User

把資料庫裡對應的key刪除了,不能刪除對應的快取資料了,只有想辦法清空了,悲劇。以前沒接觸過,查了些資料,做個記錄。

方法一、重啟進程

ps aux|grep memcache 查進程id

kill * 結束

/usr/local/sbin/memcached  啟動memcache

方法二、flush_all

串連上memcache伺服器,如telnet 127.0.0.1 11211

輸入命令flush_all即可(此命令並不刪除內容,只是把其設為到期Expired)。

更簡單點的方法

$ echo ”flush_all”| nc localhost 11211

方法三、PHP memcache

代碼如下

<?php

/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);

memcache_flush($memcache_obj);

/* OO API */

$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);

$memcache_obj->flush();

?>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.