tpac : search_HINT cache fixes
authorBill Erickson <berick@esilibrary.com>
Wed, 18 Apr 2012 20:15:46 +0000 (16:15 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 22 May 2012 19:04:52 +0000 (15:04 -0400)
When searching for multiple values like a list of IDs, generate the
cache key from the sorted JSON form of the search value instead of the
bare ARRAY ref.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm

index 57b8407..d973947 100644 (file)
@@ -73,6 +73,11 @@ sub init_ro_object_cache {
             my ($field, $val, $filterfield, $filterval) = @_;
             my $method = "search_$eclass";
             my $cacheval = $val;
+            if (ref $val) {
+                $val = [sort(@$val)] if ref $val eq 'ARRAY';
+                $cacheval = OpenSRF::Utils::JSON->perl2JSON($val); 
+                #$self->apache->log->info("cacheval : $cacheval");
+            }
             my $search_obj = {$field => $val};
             if($filterfield) {
                 $search_obj->{$filterfield} = $filterval;