Wednesday, December 26, 2012

Properly setting up CacheHelper

Hi! I have a strange issue with CacheHelper and perhaps it's because I do some error in configuration.
For the first time I encountered this problem while working on my main project. 
After it, I have downloaded CakePHP 2.2.4 and created an app for testing.

As mentioned above I'm trying to use CacheHelper. 

#### What I did:
New CakePHP 2.2.4, freshly downloaded. No changes was made except of:

core.php:
I added Configure::write('Cache.check', true); as mentioned in the Cookbook

bootstrap.php: (It was already there, so I did not make any changes.)

Configure::write('Dispatcher.filters', array(
'AssetDispatcher',
'CacheDispatcher'
));

Controller/NewsController.php – this is my controller for testing.

<?php
class NewsController extends AppController {
public $helpers = array('Cache');
public $cacheAction = array(
       'view' => 36000,
       'index'  => 48000
);

public function index() {

}

public function clear() {
clearCache();
}
}

View/News/index.ctp:

Things went OK!


#### What happened

On the first page load (domain.com/news) I can see my view rendered as expected.
If I try to access page for the second time I get the error:

Error: Class 'AppController' not found
File: ../app/Controller/NewsController.php
Line: 2

And as long as I did not clear the cache, I get the same error.
After clearing cache I can once again load page and after that everything is repeated and I get the same error.

Thanks in advance.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: