• 手动清除memcached缓存方法


    1.查memcache状态
    /usr/bin/perl /usr/local/src/memcached-1.4.5/scripts/memcached-tool localhost:11211
    或者
    telnet localhost 11211

    2.手动清除memcached测试

     1). flush_all
      echo "flush_all" | nc localhost 11211

    # telnet localhost 11211
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    get var_key
    VALUE var_key 0 13
    test variable
    END
    flush_all
    OK
    get var_key
    END
    quit
    Connection closed by foreign host.

     2). 重启memcached进程
     kill $(ps aux|grep memcached|grep -v grep |awk '{print $2}')
    /usr/local/memcached/bin/memcached -d -m 256 -p 11211 -u nobody

    3)Memcache::flush() immediately invalidates all existing items.

    /* 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();
    ?>

    这个测试的表现是请求Memcache::flush()以后仍可以get $key取到值,而且通过memcached-tool 查到该item的max_age并无变化.

    参考链接
    MicrosoftInternetExplorer402DocumentNotSpecified7.8Normal0

    理解 Memcache 的服务器端与客户端

    http://www.studyday.net/2011/07/261

  • 相关阅读:
    MySQL灾备切换
    crontab 定时任务
    Mysql常用命令 详细整理版
    linux 常用命令
    shell逻辑运算总结, 包括[[]]与[]的区别,&&与-a的区别,||与-o的区别
    linux端口详解大全
    编译安装php5.6
    linux给用户添加sudo权限
    Effective C#(二)
    Effective C#(一)
  • 原文地址:https://www.cnblogs.com/mr-amazing/p/4642493.html
Copyright © 2020-2023  润新知