파일캐시 부화 줄이기??
[code]
define('cache_time', 1); // 캐싱 5분
define('cache_dir', G5_PATH."/cache/"); // 폴더 경로
define('cache_prefix', "g5_cache_"); // 접두사
function cache_state($cache_name){
$cache_file = cache_prefix.$cache_name.".php";
if(is_file(cache_dir.$cache_file) == 1){
if((time()-filemtime(cache_dir.$cache_file)) >= cache_time*60){
$cache_state = true;
}
}else{
$cache_state = true;
}
return $cache_state;
}
function cache_write($cache_name, $cache_content=""){
$cache_file = cache_prefix.$cache_name.".php";
if($cache_content){
$cache = fopen(cache_dir.$cache_file, "w");
fwrite($cache, $cache_content);
fclose($cache);
$Return = $cache_content;
}else{
ob_start();
include_once(cache_dir.$cache_file);
$Return = ob_get_contents();
ob_end_clean();
}
return $Return;
}
ob_start();
echo "동해물과 백두산이 마르고 닳도록";
$Content = ob_get_contents();
ob_end_clean();
$cache_name = "main2";
if(cache_state($cache_name)){
echo cache_write($cache_name, $Content);
}else{
echo cache_write($cache_name);
}
[/code]
ob_start();
echo "동해물과 백두산이 마르고 닳도록";
$Content = ob_get_contents();
ob_end_clean();
이사이에 mysql 쿼리문이나 그런것들 작동시키면 되겠죠?!
효과가 있을진 모르겠네요..
원랜 db를 이용해서 하긴했는데 파일로 한번 만들어봤어요
폴더 생성하고 퍼미션 주셔야 합니다.
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4426 | ||
| 2694 | 2개월 전 | 194 | ||
| 2693 | 2개월 전 | 152 | ||
| 2692 | 2개월 전 | 160 | ||
| 2691 | 2개월 전 | 176 | ||
| 2690 | 2개월 전 | 328 | ||
| 2689 | 2개월 전 | 238 | ||
| 2688 |
|
2개월 전 | 442 | |
| 2687 | 2개월 전 | 294 | ||
| 2686 |
선택과집중
|
2개월 전 | 331 | |
| 2685 | 2개월 전 | 293 | ||
| 2684 | 2개월 전 | 353 | ||
| 2683 | 3개월 전 | 484 | ||
| 2682 | 3개월 전 | 279 | ||
| 2681 | 3개월 전 | 305 | ||
| 2680 |
선택과집중
|
3개월 전 | 278 | |
| 2679 | 3개월 전 | 333 | ||
| 2678 |
|
3개월 전 | 430 | |
| 2677 |
|
3개월 전 | 504 | |
| 2676 | 3개월 전 | 330 | ||
| 2675 | 3개월 전 | 307 | ||
| 2674 |
선택과집중
|
3개월 전 | 481 | |
| 2673 |
|
3개월 전 | 323 | |
| 2672 | 3개월 전 | 339 | ||
| 2671 | 3개월 전 | 287 | ||
| 2670 | 3개월 전 | 262 | ||
| 2669 | 3개월 전 | 374 | ||
| 2668 | 3개월 전 | 291 | ||
| 2667 |
선택과집중
|
3개월 전 | 487 | |
| 2666 |
선택과집중
|
3개월 전 | 472 | |
| 2665 |
선택과집중
|
3개월 전 | 411 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기