r14669 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14668‎ | r14669 | r14670 >
Date:22:57, 8 June 2006
Author:brion
Status:old
Tags:
Comment:
Add $wgLuceneCacheExpiry in place of hard-coded 15 minute cache expiry
Modified paths:
  • /trunk/extensions/LuceneSearch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LuceneSearch.php
@@ -41,6 +41,9 @@
4242 $wgLuceneDisableSuggestions = false;
4343 $wgLuceneDisableTitleMatches = false;
4444
 45+/** Number of seconds to cache query results */
 46+$wgLuceneCacheExpiry = 60 * 15;
 47+
4548 # Not a valid entry point, skip unless MEDIAWIKI is defined
4649 if (!defined('MEDIAWIKI')) {
4750 die( "This file is part of MediaWiki, it is not a valid entry point\n" );
@@ -648,7 +651,7 @@
649652 // Cache results for fifteen minutes; they'll be read again
650653 // on reloads and paging.
651654 $key = $wgDBname.':lucene:' . md5( $searchPath );
652 - $expiry = 60 * 15;
 655+
653656 $resultSet = $wgMemc->get( $key );
654657 if( is_object( $resultSet ) ) {
655658 wfDebug( "$fname: got cached lucene results for key $key\n" );
@@ -716,7 +719,8 @@
717720 $resultSet = new LuceneSearchSet( $resultLines, $totalHits, $suggestion );
718721
719722 wfDebug( $fname.": caching lucene results for key $key\n" );
720 - $wgMemc->add( $key, $resultSet, $expiry );
 723+ global $wgLuceneCacheExpiry;
 724+ $wgMemc->add( $key, $resultSet, $wgLuceneCacheExpiry );
721725
722726 wfProfileOut( $fname );
723727 return $resultSet;

Status & tagging log