QuickSearch Caching Hack

Looking into caching, I came up with the following for QuickSearch:

 $Tickets->ClearRestrictions;
 $Tickets->LimitStatus(VALUE => "new");
 $Tickets->LimitQueue(VALUE => $queue->Name, OPERATOR => '=');

 my $new = $m->cache->get($queue->Name . 'new');
 if (! defined($new)){
    $m->cache->set ($queue->Name . 'new', $Tickets->Count(), '5m');
    $new = $m->cache->get($queue->Name . 'new');
    $nocache = 1;
 }

 $Tickets->ClearRestrictions;
 $Tickets->LimitStatus(VALUE => "open");
 $Tickets->LimitQueue(VALUE => $queue->Name, OPERATOR => '=');

 my $open = $m->cache->get($queue->Name . 'open');
 if (! defined($open)){
    $m->cache->set ($queue->Name . 'open',$Tickets->Count(), '5m');
    $open = $m->cache->get($queue->Name . 'open');
 }

This has greatly increased the homepage loading speed to the point where
it’s on par with RT2.0 (depending on how many tickets the user owns/requested.
I’m not sure if this is the best way of implementing something like this
or it should be applied on a more global scale.

Attached is the diff.

Dean

Quicksearch.diff (1.3 KB)

Opps, forgot to take out all my debugging info.
"$nocache = 1;" isn’t suppose to be there.

Attached a new diff.

Dean

Quicksearch.diff (1.28 KB)