#!/usr/bin/perl
use strict;
use Redis;
my $redis = Redis->new(server => '192.168.119.131:8080');
my $num;
my $i;
for ($i=1;$i<10000000;$i++){
$num = hash($i);
$redis->select($num);
$redis->set($i=>"--hello--$i-->$num");
print "==$i-->$num==\n";
}
sub hash(){
my $uid = shift;
return $uid%10;
}
本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1681876