【问题标题】:using cached connections to memcached under mod_perl在 mod_perl 下使用缓存连接到 memcached
【发布时间】:2013-07-26 16:40:34
【问题描述】:

我已经在 mod_perl 启动时初始化了一个 Cache::Memcached::Fast 对象以供脚本重复使用

例如在 startup.pl 中

 $GLOBAL::memc = new Cache::Memcached::Fast({servers => '192.168.1.1:11211'});

我注意到,当脚本同时多次调用 $GLOBAL::memc->get() 时,有时会将一个进程的数据复制到另一个进程的结果中

如何确保 memc 句柄是多进程安全的

这个链接解释了一个不同的问题,即内存缓存句柄死了..但我想这也是因为同样的原因 What is the best way to create persistent memcached connections under mod_perl?

【问题讨论】:

  • 调用 get() 如何在任何地方复制任何内容?同样根据文档:Currently recognized keys are: servers...The value is a reference to an array of server addresses. 你的值是一个字符串。

标签: perl memcached mod-perl


【解决方案1】:

Is Memcached get and put methods are thread safe

使用 cas(compare and set) 函数在进程/线程之间进行适当的同步。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多