On Jun 12, 6:07 am, brian <[email protected]> wrote:
> I have a function which reorders a tree list using TreeBehavior's
> moveup()/movedown(). This list is, more or less, a set of navigation
> links. I'm using ACL so that I can display a slightly different
> version for each of several (5-10) groups. To avoid having to make an
> ACL lookup every page view, the trees are cached. So, any time a node
> is edited/added/deleted/moved, I remove the cached trees. This is
> generally ok as these actions will be performed only sporadically and
> always by an admin.
>
> To move nodes around, I'm using some jquery drag & drop and then
> sending an AJAX request. The method that handles the move includes a
> call to __removeGroupSections() (shown below). I'm consistently seeing
> this request take ~20 seconds. If I comment out the call to
> __removeGroupSections() the request comes back in ~1 second.
>
> So, can anyone suggest a faster way to accomplish this?
I'd suggest xdebug -> profile -> see where your 20s are going.
>
> Here's the config I'm using--basic file cache. I'm sure the other
> suggestions in core.php would all be much more efficient but I don't
> really know much about them. Aside from any suggestions for improving
> use of file cache, I'd appreciate any comments about the differences
> between APC, XCache, and memcached. Especially as may pertain to Cake.
> I'm definitely interested in learning something about all of this.
>
> Cache::config(
> 'default', array(
> 'engine' => 'File',
> 'duration'=> 3600,
> 'probability'=> 100,
> 'path' => CACHE,
> 'prefix' => 'cake_',
> 'lock' => false,
> 'serialize' => true
> )
> );
>
> private function __removeGroupSections($aros = array())
> {
> if (empty($aros))
> {
> $aros = $this->Acl->Aro->find('all');
> }
>
> foreach ($aros as $aro)
> {
>
> Cache::delete("sections_for_group_{$aro['Aro']['foreign_key']}");
> }
>
> }
>
> And it's not due to the ARO lookup. I hard-coded the IDs into the
> method with the same slow result:
>
> private function __removeGroupSections($aros = array())
> {
> $ids = array(1,2,3,4,5,6);
>
> foreach ($ids as $id)
> {
> Cache::delete("sections_for_group_{$id}");
> }
>
> }
Why don't you put all your acl in a single folder (e.g. tmp/cache/
acl/, create a new cache config to encompass it) then you can bulk
delete them. (e.g exec('rm -rf tmp/cache/acl/*') ) or some other such
planning for deletinging some/all strategy.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---