| 제목 | Caching 이용방법이 궁금합니다. | ||
|---|---|---|---|
| 글쓴이 | 라마야나 | 작성시각 | 2011/04/20 14:04:52 |
|
|
|||
|
2.0.2 버전을 다운 받아 운영중인 사이트 전환 작업을 CodeIgniter 로 처음으로 하고 있습니다.
$this->load->driver('cache', array('adapter' => 'file'));//, array('adapter' => 'apc', 'adapter'=>'file'));//
if(!$mainitem= $this->cache->get('mainitem'))
{
$data = $this->getItem();
$mainitem = $this->render("mainitem", $data);
// Save into the cache for 5 minutes
$this->cache->save('mainitem', $mainitem, 300);
}
echo $mainitem;
설정이 잘못되어 있을까요? /* |-------------------------------------------------------------------------- | Cache Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | system/cache/ folder. Use a full server path with trailing slash. | */ $config['cache_path']
|
|||
| 태그 | 캐싱,Caching | ||
| 다음글 | 밑의 POST 자작해결 | ||
| 이전글 | POST관련질문이요 (2) | ||
|
헛발이
/
2011/04/20 14:51:35 /
추천
0
혹시 케싱되는 폴더의 쓰기 권한같은건 하셨겠죠?
|
|
라마야나
/
2011/04/20 15:38:19 /
추천
0
네 폴더에 쓰기권한은 707 로 뒀습니다.
|
|
변종원(웅파)
/
2011/04/20 19:11:00 /
추천
0
매뉴얼 보시면 캐쉬는 컨트롤러와 뷰를 같이 사용할 경우 지원된다고 나와있습니다
|
|
라마야나
/
2011/04/20 19:51:45 /
추천
0
네 감사합니다.
cache_path 지정시 끝에 application/cache 로 했었네요; application/cache/로 수정 해두니 잘 됩니다. Caching Driver 를 이용할 경우는 컨트롤러 뷰 모델로 할 수 가 없는 것 같습니다.
$cachename = 'main';
if (! $main = $this->cache->get($cachename))
{
ob_start();
$this->load->view('main');
$main = ob_get_contents();
ob_end_clean();
$this->cache->save($cachename, $main, 300);
}
echo $main;
$this->load->view('main'); 출력물을 가져올수가 없어 ob_start(), ob_get_contents() 로 가져와야 했습니다. $main=$this->load->view('main'); 으로 받아 보려고 했으나 안되던군요. |
|
라마야나
/
2011/04/20 19:57:54 /
추천
0
Caching Driver 이용하지 않고
$this->output->cache(n) 으로 하니 잘 되는 군요 ; 더 빠르네요. Caching Drive 로드 한 거 보다. 경로 설정 잘못해서 하루종일 머리가 부글 부글!!. |
|
까리쓰마
/
2011/04/21 09:28:14 /
추천
0
$main =
$this->load->view('main', '', true);
|
|
라마야나
/
2011/05/03 08:43:59 /
추천
0
까리쓰마 님 감사합니다. |
|
들국화
/
2011/08/17 17:10:36 /
추천
0
까리쓰마/ 님
$main = $this->load->view('main', '', true);
|
|
변종원(웅파)
/
2011/08/17 19:10:06 /
추천
0
들국화/ 캐싱은 아니고 말씀하신 대로 출력방향을 바꿔서 변수에 화면내용을 담는 것입니다.
|