Commit d832dab2 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Use the new MakeClicky cache added to RT

On a new enough version of RT, this subroutine will be executed on any
MakeClicky call.  This allows us to cache for 6 hours the results of
generating links to Lookup.html (in particular, on tickets with lots of
IPs in history, this is a huge win).  Even on tickets needing minimal
processing, it helps speed up display.

One interesting quirk of this code is that MakeClicky is run on Whois
lookups and traceroute.  Traceroute provides no useful details (not even
the ticket) so it's kind of a lost cause.  Whois on the other hand
provides lookup_params, and when we get that we should punt on the
caching so we don't provide links to the wrong ticket object.
parent 18f33cc1
......@@ -238,6 +238,29 @@ ${$ARGS{handle}} = sub {
return $handle->(%args);
unless (ref $ARGS{cache} && defined ${$ARGS{cache}}) {
${$ARGS{cache}} = sub {
my $type = shift;
my $content = shift;
if ($type eq 'fetch') {
my $parent_args = $m->caller_args(1);
return if $parent_args->{lookup_params};
require Digest::SHA;
return $m->cache->get(Digest::SHA::sha512_base64($$content));
} elsif ($type eq 'store') {
require Digest::SHA;
"6 hours");
} else {
RT->Logger->error("Invalid type $type passed to MakeClicky's cache");
} else {
RT->Logger->info("Someone else defined a MakeClicky cache, skipping ours");
%{$ARGS{actions}} = ( %{$ARGS{actions}}, %actions );
push @{$ARGS{types}}, @types;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment