Zend_Config_Ini_Cache – кеширование ini файла
Фактически класс Zend_Config_Ini – это обертка функции parse_ini_file. Для нагруженных приложений каждый раз выполнять разбор ini файла это через чур. Поэтому была реализована идея кешировать результаты в виде файла. Скорость получилась сравнимой с include.
< ? /** * Project: * File: Zend/Config/Ini/Cache.php * Description: Zend Config Ini Cache Class $Rev: 40 $ $Date: 2006-08-19 12:32:18 +0300 (сб, 19 авг 2006) $ $Author: eugene $ $Id: Cache 40 2006-08-19 09:32:18Z eugene $ */ class Zend_Config_Ini_Cache extends Zend_Config_Ini { function __construct($filename, $section, $allowModifications = false,$cache_file) { $cache_file='../cache/config_cache.php'; if(!file_exists($cache_file)||filemtime($filename)!=filemtime($cache_file)) { parent::__construct($filename, $section, $allowModifications = false,$cache_file); $str=serialize($this); file_put_contents($cache_file,$str); touch ($cache_file,filectime($filename)); } else { Zend::register('config',unserialize(file_get_contents($cache_file))); } } }