Redis连接测试脚本
1.部署环境
OS: Windows 7 简体中文旗舰版 X64 SP1
Perl: ActivePerl-5.16.2.1602-MSWin32-x86-296513.msi
Redis: redis-2.8.19.zip for Windows
Perl Redis: Redis-1.966
安装方法:ppm install Redis
2.脚本内容
# redis conn_test.pl
use strict;
use redis;
my ($key, $value) = ('list1', 'dbserver_01');
my $redis = Redis->new(server => '127.0.0.1:6379');
$redis->lpush($key, $value);
my $listlen = $redis -> llen($key);
print "List insert data length: $listlen \n";
my $reval = $redis->rpop($key);
my $listlen = $redis -> llen($key);
print "$key:$reval\n";
print "List pop data length: $listlen \n";
转载于:https://blog.51cto.com/heyiyi/1598685