EllisLab text mark
Advanced Search
Config autoloading skipped when using cache
Posted: 02 August 2007 04:39 AM
Joined: 2006-12-27
16 posts

When CI displays a cached page, it loads the config.php but none of the application’s auto loaded configuration files.

This pose a problem if there are things need to be done before the cache display(using hooks or whatever) that depend on auto loaded configuration files

Posted: 02 August 2007 05:36 AM   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-06-23
370 posts

That would add unnecessary overhead for most people. There’s only one hook prior to the caching mechanism (pre_system), so there’s nothing else loaded that libraries and modesl can be pre-loaded against. They need to be assigned to the controller instance. How do you see this being solved?

I would suggest your pre-system logic not depend on autoloaded resources. You can always access the autoload.php file directly, if you need.


Mac OS X 10.8, Apache 2.x, NGiNX, PHP 5.4.x, CodeIgniter 1.7.2/2.1.3

Posted: 02 August 2007 08:55 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2006-12-27
16 posts

My specific problem is that I set (for various reasons) the $config[“site_url”] inside a separate auto-loaded config file.
And since it is not loaded automatically, the cache get broken, because it depends on correct $config[‘site_url’] .

I temporarily solved this by modifying Codeingiter.php to autoload needed config files before using the cache, but I hope to get a more standard solution