Created
November 28, 2011 22:43
-
-
Save kemo/1402435 to your computer and use it in GitHub Desktop.
Kohana 3 Route cache append
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php defined('SYSPATH') or die('No direct script access.'); | |
| class Route extends Kohana_Route { | |
| /** | |
| * Changed: | |
| * - use Cache module instead of Kohana::cache() | |
| * - append cached routes instead of assigning them directly | |
| */ | |
| public static function cache($save = FALSE) | |
| { | |
| if ($save === TRUE) | |
| { | |
| // Cache all defined routes | |
| Cache::instance()->set('Route::cache()', Route::$_routes); | |
| } | |
| else | |
| { | |
| if ($routes = Cache::instance()->get('Route::cache()')) | |
| { | |
| Route::$_routes += $routes; | |
| // Routes were cached | |
| return Route::$cache = TRUE; | |
| } | |
| else | |
| { | |
| // Routes were not cached | |
| return Route::$cache = FALSE; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment