Example #1
0
 protected function _read($modelType, $slug)
 {
     $cache = $this->_cache->read($modelType . $slug);
     if (!is_null($cache) && !Application::getDebug()) {
         $data = $cache;
     } else {
         $manager = Model::factoryManager($modelType);
         $data = $manager->read($slug, true);
         //try by slug
         if (is_null($data)) {
             $data = $manager->read($slug);
         }
         //try by id
         if (!is_null($data)) {
             $this->_cache->write($modelType . $slug, $data, true);
         }
     }
     return $data;
 }