|
|
@@ -34,12 +34,15 @@ class Router {
|
|
|
}
|
|
|
|
|
|
public static function getRoute($route) {
|
|
|
+ static $_routeInstances = null;
|
|
|
+ if (!is_array($_routeInstances)) $_routeInstances = array();
|
|
|
if (empty($route)) return;
|
|
|
+ if (array_key_exists($route, $_routeInstances)) return $_routeInstances[$route];
|
|
|
|
|
|
$routeClassName = "Route_{$route}";
|
|
|
if (Lib::tryLoadClass($routeClassName)) {
|
|
|
- $route = new $routeClassName();
|
|
|
- return $route;
|
|
|
+ $_routeInstances[$route] = new $routeClassName();
|
|
|
+ return $_routeInstances[$route];
|
|
|
} else {
|
|
|
throw new HttpException("Not found", 404);
|
|
|
}
|