/**
  * Get program object from language and publish date
  * @param string $language
  * @param integer $publishDate
  * @return VideoPageToolProgram
  */
 public static function newProgram($language, $publishDate)
 {
     wfProfileIn(__METHOD__);
     $program = new self();
     $program->setLanguage($language);
     $program->setPublishDate($publishDate);
     $memKey = $program->getMemcKey();
     $data = $program->wg->Memc->get($memKey);
     if (is_array($data)) {
         $program->loadFromCache($data);
     } else {
         $result = $program->loadFromDatabase();
         if ($result) {
             $program->invalidateCache();
             $program->saveToCache();
         }
     }
     wfProfileOut(__METHOD__);
     return $program;
 }
Example #2
0
 /**
  * Gets a new ProjectsMap instance from cache or API when not cached.
  *
  * @param string $phabricatorInstanceName The Phabricator instance name
  * @return ProjectsMap
  */
 public static function load($phabricatorInstanceName)
 {
     $instance = new self($phabricatorInstanceName);
     if ($instance->isCached()) {
         $instance->loadFromCache();
     } else {
         $instance->fetchFromAPI();
     }
     return $instance;
 }