search cache timeout is now configurable
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 19 Jun 2006 14:02:16 +0000 (14:02 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 19 Jun 2006 14:02:16 +0000 (14:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4668 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/openils.xml.example
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index f34a6b7..c61eb03 100644 (file)
@@ -203,6 +203,9 @@ For non-core config info, see the inline documentation within this file
                                                <password>MY_CONTENT_PASSWORD</password>
                                                -->
                                        </added_content>
+                                       <zips_file>/openils/var/data/zips.txt</zips_file>
+                                       <spelling_dictionary>/openils/var/data/oils_authority.dict</spelling_dictionary>
+                                       <cache_timeout>600</cache_timeout>
 
                                </app_settings>
 
index 5982a50..e63b18b 100644 (file)
@@ -32,8 +32,13 @@ my $U = $apputils;
 my $pfx = "open-ils.search_";
 
 my $cache;
+my $cache_timeout;
 sub initialize {
        $cache = OpenSRF::Utils::Cache->new('global');
+       my $sclient = OpenSRF::Utils::SettingsClient->new();
+       $cache_timeout = $sclient->config_value(
+                       "apps", "open-ils.search", "app_settings", "cache_timeout" ) || 300;
+       $logger->info("Search cache timeout is $cache_timeout");
 }
 
 
@@ -374,7 +379,7 @@ sub the_quest_for_knowledge {
 
        if( $docache ) {
                $logger->debug("putting search cache $ckey\n");
-               $cache->put_cache($ckey, \@recs, 900);
+               $cache->put_cache($ckey, \@recs, $cache_timeout);
        }
 
        return { ids => \@recs, 
@@ -383,10 +388,6 @@ sub the_quest_for_knowledge {
 
 
 
-#$cache_handle->put_cache( "_open-ils_seed_$username", $seed, 30 );
-#my $current_seed = $cache_handle->get_cache("_open-ils_seed_$username");
-#$cache_handle->delete_cache( "_open-ils_seed_$username" );
-
 sub search_cache {
 
        my $key         = shift;
@@ -846,7 +847,7 @@ sub marc_search {
 
        if(!$recs) {
                $recs = new_editor()->request($method, %$args);
-               $cache->put_cache($ckey, $recs, 900);
+               $cache->put_cache($ckey, $recs, $cache_timeout);
                $recs = [ @$recs[$offset..($offset + ($limit - 1))] ];
        }