some thoughts:
- I think session doesn't get reinstantiated everytime if you set
$security setting to lower.
- if you are using more than three (two?) requestAction calls It gets
significantly slower, since the whole controller (or even more) gets
loaded once more. If you are doing requestActions in order to
implement "modual" layout, reconsider using elements, or any of these
techniques:
http://groups.google.com/group/cake-php/web/frequent-discussions
(How to display more views/blocks in a single page?)

Or you might check my implementation of better View handling, here:
http://groups.google.com/group/cake-php/msg/bae451266e47ed2e




On 15 sep., 15:49, BCN Adam <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I've been looking for a way to speed up requestAction and wanted to
> share a hack I came up with.  It seems that the main problem is that
> the SessionComponent is re-instantiated and a new session is started
> each time.
>
> First i modified SessionComponent and added the following function:
>
>         function &getInstance() {
>                 static $instance = array();
>                 if (!$instance) {
>                         $instance[0] =& new SessionComponent;
>                 }
>                 return $instance[0];
>         }
>
> (Yes, it's very similar to the Configure::getInstance() ;-)
>
> Then in cake/libs/controller/component.php I removed lines 120-126 and
> inserted this:
>
>         if ($componentCn == 'SessionComponent') {
>                 $param = strip_plugin($this->__controller->base, 
> $this->__controller->plugin) . '/';
>
>                 $this->__controller->{$component} =&
> SessionComponent::getInstance();
>         } else {
>                 $param = null;
>                 $this->__controller->{$component} =& new $componentCn($param);
>         }
>         $loaded[$component] =& $this->__controller->{$component};
>
> Using this singleton pattern for SessionComponent I noticed a x2
> performance improvement for requestAction() (ymmv).  I am using cake
> version 1.1.16.5421, but I imagine the same can be done with other
> cake versions.
>
> Regards,
>
> Adam
>
> P.S. have been a big fan of cake since v0.2.6 - keep up the good work
> guys!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to