[rt-devel] QuickSearch Caching Hack
Dean Kao
nouveaux at lightconsulting.com
Wed Apr 23 17:12:23 EDT 2003
Opps, forgot to take out all my debugging info.
"$nocache = 1;" isn't suppose to be there.
Attached a new diff.
Dean
-------------- next part --------------
--- Quicksearch.old Wed Apr 23 13:38:15 2003
+++ Quicksearch Wed Apr 23 13:51:46 2003
@@ -33,15 +33,26 @@
<%PERL>
my $i;
while (my $queue = $Queues->Next) {
+
$Tickets->ClearRestrictions;
- $Tickets->LimitStatus(VALUE => "open");
+ $Tickets->LimitStatus(VALUE => "new");
$Tickets->LimitQueue(VALUE => $queue->Name, OPERATOR => '=');
- my $open = $Tickets->Count();
+
+ my $new = $m->cache->get($queue->Name . 'new');
+ if (! defined($new)){
+ $m->cache->set ($queue->Name . 'new', $Tickets->Count(), '1m');
+ $new = $m->cache->get($queue->Name . 'new');
+ }
$Tickets->ClearRestrictions;
- $Tickets->LimitStatus(VALUE => "new");
+ $Tickets->LimitStatus(VALUE => "open");
$Tickets->LimitQueue(VALUE => $queue->Name, OPERATOR => '=');
- my $new = $Tickets->Count();
+
+ my $open = $m->cache->get($queue->Name . 'open');
+ if (! defined($open)){
+ $m->cache->set ($queue->Name . 'open',$Tickets->Count(), '1m');
+ $open = $m->cache->get($queue->Name . 'open');
+ }
</%PERL>
% $i++;
More information about the Rt-devel
mailing list