#최적화 캐싱 function get_option( $option
로빈아빠
본문
wp-includes/option.php
function get_option( $option, $default = false ) {
$time_start = microtime(true);
$tmp=dirname(__FILE__)."/../../tmp/option.wp_load_alloptions.tmp";
//echo $tmp,"<BR>";
if (!is_file($tmp)||filemtime($tmp)<time()-30*60) {
$alloptions = wp_load_alloptions();
file_put_contents($tmp,serialize($alloptions));
//echo "..reload..";
}
else {
$alloptions=unserialize(file_get_contents($tmp));
//echo "..cached..";
}
if (defined("DEBUG1")) {
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "Did nothing in $time seconds <BR>";
var_dump($alloptions);
exit;
}
결과 평균 0.2 -> 0.02 초로 개선됨..
댓글목록
등록된 댓글이 없습니다.