我想在gearmand客户端和worker之间使用Cache :: FastMmap共享数据。它失败了。
例如: client.pm ...
our $nodes_cache = Cache::FastMmap->new();
@nodes_array=$nodes_cache->get_keys(0);
foreach my $node(@nodes_array){
my $sgl_node_args = $nodes_cache->get_and_remove($node);
my ($ret1, $task) = $get_arp_clt->add_task("get_arp_worker", freeze(\$sgl_node_args));
}
@nodes_array=$nodes_cache->get_keys(0);
print "nodes_array:",$#nodes_array;
gearman_work.pl
...
$client::nodes_cache->set($new_key, $new_value);
@worker_array=$client::nodes_cache->get_keys(0);
print "worker_array:",$#worker_array;
geramn_work.pl结果: worker_array:82
客户结果: nodes_array:0
它有什么问题?