The method URL::base()
is processing of value on each call. Can be better to cache it by sample Lasy Load pattern?
Example:
public static function base($protocol = NULL, $index = FALSE)
{
// Beforehand to add property "private static $base_url";
if (Valid::not_empty(self::$base_url))
{
return self::$base_url;
}
// Start with the configured base URL
$base_url = Kohana::$base_url;
if ($protocol === TRUE)
{
// Use the initial request to get the protocol
$protocol = Request::$initial;
}
...