安装Cache::Memcahced模块
首先安装配置cpan,使用cpan来安装Cache::Memcahced模块
yum -y install cpan
vim /usr/share/perl5/CPAN/Config.pm
将镜像路径设置为:
‘urllist‘ => [q[http://mirrors.ustc.edu.cn/CPAN/]],
安装:
perl -MCPAN -e shell
cpan[1]> install Cache::Memcahced
开始安装……
创建perl文件执行测试:
vim mem.pl
内容如下:
#!/usr/bin/perl
use Cache::Memcached;
my $key = "foo";
my $value = "bar";
my $expires = 3600; # 1 hour
my $memcached = Cache::Memcached->new({
servers => ["127.0.0.1:11211"],
compress_threshold => 10_000
});
$memcached->add($key, $value, $expires);
my $ret = $memcached->get($key);
print "$ret\n";
执行mem.pl输出内容为bar说明正确;
memcahced perl 测试,布布扣,bubuko.com
原文地址:http://zrer90.blog.51cto.com/8679896/1535830