fixed some cache bugs, caching 5k results
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jun 2006 17:19:48 +0000 (17:19 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jun 2006 17:19:48 +0000 (17:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4841 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index 9203e5f..eb7007c 100644 (file)
@@ -339,20 +339,20 @@ sub the_quest_for_knowledge {
        my $ismeta = 0;
        my @recs;
 
-       my $maxlimit = 500;
 
-       my $offset = $searchhash->{offset} || 0;
-       my $limit = $searchhash->{limit} || 10;
-       my $end = $offset + $limit - 1;
-       $searchhash->{offset} = 0;
-       $searchhash->{limit} = $maxlimit;
+       my $offset      = $searchhash->{offset} || 0;
+       my $limit       = $searchhash->{limit} || 10;
+       my $end         = $offset + $limit - 1;
+
+       my $maxlimit = 5000;
+       $searchhash->{offset}   = 0;
+       $searchhash->{limit}            = $maxlimit;
 
        my @search;
        push( @search, ($_ => $$searchhash{$_})) for (sort keys %$searchhash);
        my $ckey = $pfx . md5_hex($method . JSON->perl2JSON(\@search));
 
-       #$searchhash->{offset} = $offset;
-       #$searchhash->{limit} = $limit;
+       $searchhash->{limit} -= $offset;
 
        if($self->api_name =~ /metabib/) {
                $ismeta = 1;
@@ -360,7 +360,8 @@ sub the_quest_for_knowledge {
        }
 
        # don't cache past max limit
-       my $result = ($end < $maxlimit) ? search_cache($ckey, $offset, $limit) : undef; 
+       my $result = ($end < $searchhash->{limit}) ? 
+               search_cache($ckey, $offset, $limit) : undef; 
        my $docache = 1;
 
        if(!$result) {
@@ -426,11 +427,12 @@ sub search_cache {
        my $offset      = shift;
        my $limit       = shift;
 
-       $logger->debug("searching cache for $key\n");
 
        my $start = $offset;
        my $end = $offset + $limit - 1;
 
+       $logger->debug("searching cache for $key : $start..$end\n");
+
        return undef unless $cache;
        my $data = $cache->get_cache($key);