DB\IO switch dbReturn, dbReturnParams to NO_CACHE as default
Cache is never used, so to keep memory default lower, lets switch to NO_CACHE
This commit is contained in:
@@ -67,12 +67,30 @@ $q_db_ret = "SELECT * FROM test_db_return ORDER BY uid";
|
||||
|
||||
RunningTime::hrRunningTime();
|
||||
|
||||
$cache_flag = '[DEFAULT] NO_CACHE (0)';
|
||||
print "dbReturn '" . $cache_flag . "'/Default: " . $q_db_ret . "<br>";
|
||||
// Do twice
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
$res = $db->dbReturn($q_db_ret);
|
||||
print $i . ") " . $cache_flag . ": "
|
||||
. "res: " . (is_bool($res) ?
|
||||
"<b>Bool:</b> " . $db->log->prBl($res) :
|
||||
(is_array($res) ?
|
||||
"Array: " . $db->log->prBl(is_array($res)) : '{-}')
|
||||
) . ", "
|
||||
. "cursor_ext: <pre>" . Support::printAr(
|
||||
SetVarType::setArray($db->dbGetCursorExt($q_db_ret))
|
||||
) . "</pre>";
|
||||
print "Run time: " . RunningTime::hrRunningTime() . "<br>";
|
||||
}
|
||||
print "<hr>";
|
||||
|
||||
$cache_flag = 'USE_CACHE (0)';
|
||||
print "dbReturn '" . $cache_flag . "'/Default: " . $q_db_ret . "<br>";
|
||||
// SINGLE read on multi row return
|
||||
// Do twice
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
$res = $db->dbReturn($q_db_ret);
|
||||
$res = $db->dbReturn($q_db_ret, $db::USE_CACHE);
|
||||
print $i . ") " . $cache_flag . ": "
|
||||
. "res: " . (is_bool($res) ?
|
||||
"<b>Bool:</b> " . $db->log->prBl($res) :
|
||||
|
||||
@@ -1821,7 +1821,7 @@ class IO
|
||||
* Wrapper for dbReturnParams
|
||||
*
|
||||
* @param string $query Query string
|
||||
* @param int $cache reset status: default: USE_CACHE
|
||||
* @param int $cache reset status: default: NO_CACHE
|
||||
* USE_CACHE/0: normal read from cache on second run
|
||||
* READ_NEW/1: write to cache, clean before new run
|
||||
* CLEAR_CACHE/2: write cache, clean after finished
|
||||
@@ -1833,7 +1833,7 @@ class IO
|
||||
*/
|
||||
public function dbReturn(
|
||||
string $query,
|
||||
int $cache = self::USE_CACHE,
|
||||
int $cache = self::NO_CACHE,
|
||||
bool $assoc_only = false
|
||||
): array|false {
|
||||
return $this->dbReturnParams($query, [], $cache, $assoc_only);
|
||||
@@ -1856,7 +1856,7 @@ class IO
|
||||
*
|
||||
* @param string $query Query string
|
||||
* @param array<mixed> $params Query parameters
|
||||
* @param int $cache reset status: default: USE_CACHE
|
||||
* @param int $cache reset status: default: NO_CACHE
|
||||
* USE_CACHE/0: normal read from cache on second run
|
||||
* READ_NEW/1: write to cache, clean before new run
|
||||
* CLEAR_CACHE/2: write cache, clean after finished
|
||||
@@ -1868,7 +1868,7 @@ class IO
|
||||
public function dbReturnParams(
|
||||
string $query,
|
||||
array $params = [],
|
||||
int $cache = self::USE_CACHE,
|
||||
int $cache = self::NO_CACHE,
|
||||
bool $assoc_only = false
|
||||
): array|false {
|
||||
$this->__dbErrorReset();
|
||||
|
||||
Reference in New Issue
Block a user