The mysqli::refresh() / mysqli_refresh() function flushes tables or caches, or resets the replication server information.
Syntax
//Object-oriented style
public mysqli::refresh(flags)
//Procedural style
mysqli_refresh(mysql, flags)
Parameters
mysql |
Required. For procedural style only: Specify a mysqli object returned by mysqli_connect() or mysqli_init(). |
flags |
Required. Specify the options to refresh, using a bitmask of MYSQLI_REFRESH_* constants. It can take the following values:
Constants | Description |
MYSQLI_REFRESH_GRANT | Refreshes the grant tables. |
MYSQLI_REFRESH_LOG | Flushes the logs, like executing the FLUSH LOGS SQL statement. |
MYSQLI_REFRESH_TABLES | Flushes the table cache, like executing the FLUSH TABLES SQL statement. |
MYSQLI_REFRESH_HOSTS | Flushes the host cache, like executing the FLUSH HOSTS SQL statement. |
MYSQLI_REFRESH_REPLICA | Alias of MYSQLI_REFRESH_SLAVE constant. Available as of PHP 8.1.0. |
MYSQLI_REFRESH_STATUS | Reset the status variables, like executing the FLUSH STATUS SQL statement. |
MYSQLI_REFRESH_THREADS | Flushes the thread cache. |
MYSQLI_REFRESH_SLAVE | On a slave replication server: resets the master server information, and restarts the slave. Like executing the RESET SLAVE SQL statement. |
MYSQLI_REFRESH_MASTER | On a master replication server: removes the binary log files listed in the binary log index, and truncates the index file. Like executing the RESET MASTER SQL statement. |
|
Return Value
Returns true if the refresh was a success, otherwise false.
❮ MySQLi Functions Reference