/** * Find a certain object * * @param string $uri UID of the object * @param integer $type * @throws \OCA\Calendar\BusinessLayer\Exception * @return \OCA\Calendar\IObject */ public function find($uri, $type = ObjectType::ALL) { try { if ($this->isCachingEnabled) { if ($this->watcher->checkUpdate($uri)) { $this->updater->propagate($uri); } return $this->cache->find($uri, $type); } else { return $this->api->find($uri, $type); } } catch (BackendUtils\Exception $ex) { throw Exception::fromException($ex); } }
/** * @param $objectUri * @return null|IObject */ protected function getRemoteAndDeleteIfNecessary($objectUri) { try { return $this->objectAPI->find($objectUri); } catch (DoesNotExistException $ex) { //$this->logger->debug($msg); $this->removeFromCache($objectUri); return null; } catch (MultipleObjectsReturnedException $ex) { //$this->logger->warn($msg); $this->removeFromCache($objectUri); return null; } catch (TemporarilyNotAvailableException $ex) { //$this->logger->debug($msg); return null; } catch (CorruptDataException $ex) { //$this->logger->debug($msg); $this->removeFromCache($objectUri); return null; } }