加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

mod_perl跨子进程共享变量

发布时间:2020-12-15 23:32:11 所属栏目:大数据 来源:网络整理
导读:我有一个mod_perl系统接受来自不同客户端系统的API调用 假设在子perl程序中我有这样的调用,它做了一些繁重的处理 $conf{$client_id} = generate_client_conf($client_id); # returns a ref to a hash 我想在其他子进程中重用这个变量$conf {$client_id} 我怎
我有一个mod_perl系统接受来自不同客户端系统的API调用
假设在子perl程序中我有这样的调用,它做了一些繁重的处理

$conf{$client_id} = generate_client_conf($client_id); # returns a ref to a hash

我想在其他子进程中重用这个变量$conf {$client_id}
我怎样才能做到这一点 ?

变量无法在startup.pl中加载,但需要在生成后进行缓存

解决方法

你应该使用 Cache::FastMmap

In mod_perl,just open the cache at the global level in the appropriate module,which is executed as the server is starting and before it starts forking children,but you’ll probably want to chmod or chown the file to the permissions of the apache process.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读