public function getCustom(SelectQuery $query, $expires = Cache::DO_NOT_CACHE) { if ($query->getLimit() > 1) { throw new WrongArgumentException('can not handle non-single row queries'); } $db = DBPool::getByDao($this->dao); if ($expires !== Cache::DO_NOT_CACHE && ($object = $this->getCachedByQuery($query))) { if ($object === Cache::NOT_FOUND) { throw new CachedObjectNotFoundException(); } return $object; } elseif ($object = $db->queryRow($query)) { if ($expires === Cache::DO_NOT_CACHE) { return $object; } else { return $this->cacheByQuery($query, $object, $expires); } } else { throw new ObjectNotFoundException("zero" . (defined('__LOCAL_DEBUG__') ? "for query == " . $query->toDialectString(DBPool::me()->getByDao($this->dao)->getDialect()) : null)); } }