config_load API and caching feature
| From: | Monte Ohrt | Date: | Mon, 09 Dec 2002 19:59:09 +0000 |
| Subject: | config_load API and caching feature | ||
| Groups: | php.smarty.dev php.smarty.general | ||
| Request: | Send a blank email to php-smarty-dev+get-388@lists.php.net to get a copy of this message | ||
Hi,
In CVS, I added a config_load() API call so you can load config files
from your apps just as you can from the templates. There is also a
clear_config() API call. Docs are coming soon. The config vars are no
longer reset between calls to fetch() and display(). I don't really see
a reason to be doing that anyways, but speak up if that's a problem.
developer stuff:
config files are now transparently cached instead of reading an parsing
the file on every page. It serializes the data that was parsed, then
unserializes it from the cache unless the original file is changed. In
my first tests, I had a 3x speedup in a "hello world" config file with
one variable. Then I took a fairly complex config file from a real app
with ~130 variables I saw a 17x speedup (!!!) kudos to those that
contributed to this idea.
The Config_File class is now configurable much like the Smarty_Compiler,
so you can use your own code if you want to do custom config file
loading. This is a stepping stone for a config file resource solution.
I'm running the new setup on our internal test enviroment (huge CMS
system) and all looks good so far, lots of config files being cached :-)
Test this stuff out! Thanks.
Monte