thinkphp6 Command 监听redis过期的问题
protected function execute(Input $input, Output $output)
{
$redis = Cache::store('crx_upfile')->handler();
//设置redis超时时间 -1永不超时
$redis->setOption(\Redis::OPT_READ_TIMEOUT, -1);
//订阅redis * 库的过期事件,触发app\command\RedisZeroCallback::keycallback命令
$redis->psubscribe(array('__keyevent@0__:expired'), 'app\command\RedisZeroCallback::keycallback');
//$output->writeln('回调完了');
}
public static function keycallback($redisp, $pattern, $chan, $msg){
echo 1111;
$redisp->set("er","232");
var_dump($redisp->get("er"));
}
为什么$redisp->set没反应?keycallback里就算重新$redis = Cache::store('crx_upfile')->handler();也没反应