clearState
开服前的清理操作,只支持同步的写法。
例子:
public function clearState()
{
print("是否清除Redis上的用户状态信息(y/n)?");
$clear_redis = shell_read();
if (strtolower($clear_redis) == 'y') {
echo "[初始化] 清除Redis上用户状态。\n";
$this->getRedis()->del(SwooleMarco::redis_uid_usid_hash_name);
$this->getRedis()->close();
unset($this->redis_client);
}
}
shell_read是在Common.php中定义的方法。用户获取用户的输入。