mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-24 08:52:45 +00:00
Add more query time measurements
This commit is contained in:
parent
84473a0cad
commit
da57370385
@ -32,8 +32,10 @@ $uuid_name_cache = [];
|
|||||||
function get_name($uuid) {
|
function get_name($uuid) {
|
||||||
global $conn, $table_history, $uuid_name_cache;
|
global $conn, $table_history, $uuid_name_cache;
|
||||||
if (array_key_exists($uuid, $uuid_name_cache)) return $uuid_name_cache[$uuid];
|
if (array_key_exists($uuid, $uuid_name_cache)) return $uuid_name_cache[$uuid];
|
||||||
|
$time = microtime(true);
|
||||||
$stmt = $conn->prepare("SELECT name FROM " . $table_history . " WHERE uuid=? ORDER BY date DESC LIMIT 1");
|
$stmt = $conn->prepare("SELECT name FROM " . $table_history . " WHERE uuid=? ORDER BY date DESC LIMIT 1");
|
||||||
if ($stmt->execute(array($uuid)) && $row = $stmt->fetch()) {
|
if ($stmt->execute(array($uuid)) && $row = $stmt->fetch()) {
|
||||||
|
echo('<!-- Query executed in ' . (microtime(true) - $time) . ' sec -->');
|
||||||
$banner = $row['name'];
|
$banner = $row['name'];
|
||||||
$uuid_name_cache[$uuid] = $banner;
|
$uuid_name_cache[$uuid] = $banner;
|
||||||
return $banner;
|
return $banner;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user