<?php
ini_set('max_execution_time', '0');
$node = json_decode(file_get_contents('./redis.json'),true);
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->auth('123456'); //设置密码
$table = $redis->lrange('list', 0, -1);
$task = array_unique($table);
foreach ($task as $value){
$cont = explode('-',$value);
foreach ($node as $v){
$node = new Redis();
$node->connect($v['ip'], $v['host']);
$node->auth($v['pass']); //设置密码
$res = $node->set($cont[0]."-BLOCK-".$cont[1], 1);
if(!$res){
file_put_contents('redis_error.txt',$log);
}else{
$node->expire($cont[0]."-BLOCK-".$cont[1], $cont[2]);
$node->close();
}
}
//注意:lrem方法与lua参数顺序不一样! php: lrem(key,value,count) lua: lrem(key,count,value)
$redis->lrem('list',$value,0);
}
$redis->close();
echo 'success';
最后修改:2021 年 03 月 17 日
© 允许规范转载