Ejemplo n.º 1
0
 public static function initCacheRoute()
 {
     if ($redisRoute = tRedis::get('RoutesCache')) {
         self::$route_array = json_decode($redisRoute, true);
         return;
     }
     if (is_file(APP_PATH . '/config/routes.php')) {
         self::$route_array = (include APP_PATH . '/config/routes.php');
     }
     tRedis::set("RoutesCache", json_encode(self::$route_array));
     return;
 }
Ejemplo n.º 2
0
 public static function MidWare($name)
 {
     if (!($midware = tRedis::hget("midWareCache", $name))) {
         if (isset(self::$midware[$name])) {
             $midware = self::$midware[$name];
         }
     }
     if ($midware) {
         return new $midware();
     } else {
         return null;
     }
 }
Ejemplo n.º 3
0
 public static function boot()
 {
     date_default_timezone_set("Asia/Shanghai");
     if (version_compare(PHP_VERSION, 5.5, "<")) {
         exit("PHP required 5.5+");
     }
     set_exception_handler(array(__CLASS__, 'panic'));
     tRedis::newInstance();
     Route::initCacheRoute();
     Config::init();
     Dependency::initCache();
     Model::initCache();
     Factory::make("session")->start();
     $self = new static();
     $self->route = Route::newInstance();
     $self->request = Request::newInstance();
     return $self;
 }