xPDOObject|null getObject (string $className, [xPDOCriteria|array|str|int $criteria = null], [bool|int $cacheFlag = true])
* @param boolean|integer $cacheFlag Indicates if the objects should be
* cached and optionally, by specifying an integer value, for how many
* seconds.Looking at the code, it appears that you're right. I was going by this:Not at all, so long as any save() is called without sending false to the $cacheFlag parameter as well.
* @param boolean|integer $cacheFlag Indicates if the objects should be * cached and optionally, by specifying an integer value, for how many * seconds.
If we're right, you lose the ability to create/update the cache for the object when you ask for the fresh object.
if ($xpdo->_cacheEnabled && $criteria->cacheFlag && $cacheFlag) {
$row= $xpdo->fromCache($criteria, $className);
}
if (!$fromCache && $cacheFlag && $xpdo->_cacheEnabled) {
$xpdo->toCache($criteria, $instance, $cacheFlag);Now I'm confused. Doesn't this code mean that for any $cacheFlag value other than false or 0 , you'll be getting the object from the cache rather than a fresh object from the DB?
if ($xpdo->_cacheEnabled && $criteria->cacheFlag && $cacheFlag) { $row= $xpdo->fromCache($criteria, $className); }
So to get a fresh object, $cacheFlag has to be false. Then this code that updates the cache wouldn't execute, no?
if (!$fromCache && $cacheFlag && $xpdo->_cacheEnabled) { $xpdo->toCache($criteria, $instance, $cacheFlag);
What am I missing?