简体   繁体   English

使用缓存连接到mod_perl下的memcached

[英]using cached connections to memcached under mod_perl

I have initialized a Cache::Memcached::Fast object in the mod_perl startup for re-use by the scripts 我已经在mod_perl启动中初始化了一个Cache :: Memcached :: Fast对象,以供脚本重新使用

For eg in startup.pl 例如在startup.pl

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

I notice that when multiple calls to $GLOBAL::memc->get() happen simultaneously to the scripts the data for 1 process is sometimes copied to the results of the other 我注意到,当脚本同时发生对$ GLOBAL :: memc-> get()的多次调用时,有时一个进程的数据会复制到另一个进程的结果中

How can I make sure the memc handles are multi process-safe 我如何确保memc句柄是多进程安全的

This link explains a different problem , that the memcache handle dies .. but I guess this is also because of the same reason What is the best way to create persistent memcached connections under mod_perl? 该链接说明了一个不同的问题,即内存缓存句柄死了..但是我想这也是由于相同的原因。在mod_perl下创建持久性内存缓存连接的最佳方法是什么?

Is Memcached get and put methods are thread safe Memcached的get和put方法是否是线程安全的

use cas(compare and set) function to have proper syncronization between processes/threads. 使用cas(compare and set)函数在进程/线程之间进行适当的同步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM