// read a template file
function ets_source_read_handler($template)
{
$content = FALSE;
if ($handle = @fopen($template, 'rb')) {
$size = @filesize($template);
$content = @fread($handle, $size);
fclose($handle);
}
return $content;
}
// retrieve a parsed template from shared memory
function ets_cache_read_handler($template)
{
$content = FALSE;
$t_template = mmcache_get("T_$template");
if ($t_template > @filemtime($template)) {
$content = mmcache_get("C_$template");
if (is_null($content)) {
$content = FALSE;
}
}
return $content;
}
// store a parsed template into shared memory
function ets_cache_write_handler($template, $content)
{
mmcache_put("T_$template", time());
mmcache_put("C_$template", $content);
}