/** * @return Tracker_FormElement_Field_ComputedDaoCache */ public static function instance() { if (!self::$instance) { $class = __CLASS__; self::$instance = new $class(new Tracker_FormElement_Field_ComputedDao()); } return self::$instance; }
/** * @return int | null if no value found */ public function getCachedValue(PFUser $user, Tracker_Artifact $artifact, $timestamp = null) { $dao = Tracker_FormElement_Field_ComputedDaoCache::instance(); $value = $dao->getCachedFieldValueAtTimestamp($artifact->getId(), $this->getId(), $timestamp); if ($value === false) { $value = $this->getComputedValue($user, $artifact, $timestamp); $dao->saveCachedFieldValueAtTimestamp($artifact->getId(), $this->getId(), $timestamp, $value); } return $value; }