/trunk/doc/config_values.md |
---|
329,9 → 329,13 |
OIDplus::baseConfig()->setValue('OBJECT_CACHING', true); |
Object caching reads all objects in the memory. This increases performance |
performance but also increases memory usage on large databases. |
Object caching reads all objects from the database in the memory at every request. |
This increases the speed on small databases (but also uses more memory), |
but makes OIDplus VERY slow if the database is big (> 10.000 OIDs). |
So, if you want (or must) use little RAM, or have a lot of objects in the |
database, please turn off `OBJECT_CACHING`. |
### FORCE_DBMS_SLANG |
OIDplus::baseConfig()->setValue('FORCE_DBMS_SLANG', ''); |
/trunk/includes/classes/OIDplusObject.class.php |
---|
762,8 → 762,13 |
*/ |
public function equals($obj): bool { |
if (!$obj) return false; |
if (!is_object($obj)) $obj = OIDplusObject::parse($obj); |
if (!is_object($obj)) { |
if ($this->nodeId(true) === $obj) return true; // simplest case |
$obj = OIDplusObject::parse($obj); |
if (!$obj) return false; |
} else { |
if ($this->nodeId(true) === $obj->nodeId(true)) return true; // simplest case |
} |
if (!($obj instanceof $this)) return false; |
$distance = $this->distance($obj); |
781,11 → 786,13 |
$obj = OIDplusObject::parse($search_id); |
if (!$obj) return false; // e.g. if ObjectType plugin is disabled |
if ($obj->nodeId(false) == '') return false; // speed optimization. "oid:" is not equal to any object in the database |
if (!OIDplus::baseConfig()->getValue('OBJECT_CACHING', true)) { |
$res = OIDplus::db()->query("select id from ###objects where id like ?", array($obj->ns().':%')); |
while ($row = $res->fetch_object()) { |
$test = OIDplusObject::parse($row->id); |
if ($obj->equals($test)) return $test; |
if ($test && $obj->equals($test)) return $test; |
} |
return false; |
} else { |
793,7 → 800,7 |
foreach (self::$object_info_cache as $id => $cacheitem) { |
if (strpos($id, $obj->ns().':') === 0) { |
$test = OIDplusObject::parse($id); |
if ($obj->equals($test)) return $test; |
if ($test && $obj->equals($test)) return $test; |
} |
} |
return false; |
/trunk/includes/classes/OIDplusQueryResult.class.php |
---|
136,7 → 136,8 |
if (!$this->containsResultSet()) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)')); |
if (!is_null($this->prefetchedArray)) { |
// Prefetched value exists. Use it. |
$ary = array_shift($this->prefetchedArray); |
//$ary = array_shift($this->prefetchedArray); |
$ary = $this->prefetchedArray[$this->countAlreadyFetched] ?? null; // Performance is better this way |
} else { |
$reflector = new \ReflectionMethod($this, 'do_fetch_array'); |
$isImplemented = ($reflector->getDeclaringClass()->getName() !== self::class); |
180,7 → 181,8 |
if (!$this->containsResultSet()) throw new OIDplusException(_L('The query has returned no result set (i.e. it was not a SELECT query)')); |
if (!is_null($this->prefetchedArray)) { |
// Prefetched value exists (as array). Convert and use it. |
$ary = array_shift($this->prefetchedArray); |
//$ary = array_shift($this->prefetchedArray); |
$ary = $this->prefetchedArray[$this->countAlreadyFetched] ?? null; // Performance is better this way |
$obj = is_null($ary) ? null : array_to_stdobj($ary); |
} else { |
$reflector = new \ReflectionMethod($this, 'do_fetch_object'); |
/trunk/userdata/baseconfig/info.txt |
---|
7,5 → 7,5 |
security keys (ReCaptcha) etc. |
Setup (/setup/) will show assist you in creating this config.inc.php file. |
In the document doc/config_values.txt, you can see a list of advanced |
In the document doc/config_values.md, you can see a list of advanced |
settings that can be manually added into the config.inc.php file. |