Okay, this is REALLY weird. I tried copying the index action and its
view to another name. It seems like unless the name of the action is
'index', the caching will not work. Again, the actions I have are
IDENTICAL. The only thing that is different is the name.
HOWEVER. If you change the $cacheAction to a string instead (so it is
the same for all actions, i.e. $cacheAction = '1 hour' for example),
then it DOES work. wtf?
On Sep 13, 12:48 pm, Kenchu <[EMAIL PROTECTED]> wrote:
> I've got this code:
>
> var $helpers = array('Cache');
> var $cacheAction = array
> (
> 'index' => '+1 hour',
> 'view' => '+1 hour'
> );
>
> [...]
>
> function view($id = null) {
> if (!$id) {
> $this->Session->setFlash(__('Invalid Post.', true));
> $this->redirect(array('action'=>'index'));
> }
> $this->set('post', $this->Post->read(null, $id));
> }
>
> function index() {
> $data = $this->Post->findAll();
> $this->set('posts', $data);
> }
>
> Caching for the index works, but the queries for the view action will
> always be makde. Why? I've tried changing $cacheAction to view slash
> (/) instead, but that didnt do any difference. Fact is, if I did it
> for the index, index caching wouldnt work either at all.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---