Esempio n. 1
0
File: View.php Progetto: techart/tao
 protected function load_helperes_from_cache($helpers)
 {
     if (!CMS::is_lazy_components()) {
         return;
     }
     if ($this->is_cache_loaded) {
         return;
     }
     $this->is_cache_loaded = true;
     if ($classes = WS::env()->cache->get('cms:viwes:helpers_classes')) {
         foreach ($classes as $name => $class) {
             $helpers->append($class, $name);
         }
     } else {
         Events::add_once('cms.load_components', function () use($helpers) {
             WS::env()->cache->set('cms:viwes:helpers_classes', $helpers->classes, 0);
         });
         CMS::load_components();
     }
 }
Esempio n. 2
0
File: ORM.php Progetto: techart/tao
 protected function load_cache()
 {
     if (!CMS::is_lazy_components()) {
         return;
     }
     if ($this->is_cache_loaded) {
         return;
     }
     $this->is_cache_loaded = true;
     if ($classes = $this->cache->get('cms:orm:classes')) {
         $this->mappers = array_replace_recursive($classes, $this->mappers, self::$classes);
     } else {
         $self = $this;
         $cache = $this->cache;
         Events::add_once('cms.load_components', function () use($self, $cache) {
             $mappers = array_replace_recursive(CMS_ORM_Root::$classes, $self->get_mappers());
             $cache->set('cms:orm:classes', $mappers, 0);
         });
         CMS::load_components();
     }
 }