我怎么能删除memcache中的特定键

时间:2015-09-03 08:27:05

标签: memcached

以下是memcached服务器中的密钥,

我如何以_session_id为前缀

来持有cache_key

删除其他密钥,谢谢。

目前,清除缓存脚本

    server  = ENV['MEMCACHE_DB']
    port    = 11211
    command = "flush_all\r\n"
    socket = TCPSocket.new(server, port)
    socket.write(command)
    result = socket.recv(2)
    if result != 'OK'
      STDERR.puts "Error flushing memcached: #{result}"
    end
    socket.close

|      id |                      expires |        bytes | cache_key                                    |
|       4 |    2016-03-01 07:56:32 +0000 |           74 | _session_id:c93a596166486d7d40cd6170b14c435d |
|      12 |    2015-09-03 07:53:08 +0000 |         1070 | views/footer                                 |
|      13 |    2015-09-03 07:53:08 +0000 |         1162 | views/common_header                          |

0 个答案:

没有答案