【发布时间】: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.你的值是一个字符串。