[Home]DoCacheBrowse/Code

UseModWiki | DoCacheBrowse | RecentChanges | Preferences

Same Code from version 0.92 and version 1.0 :

# Simple HTML cache   
sub DoCacheBrowse {                                                            
  my ($query, $idFile, $text);

  return 0  if (!$UseCache);  
  $query = $ENV{'QUERY_STRING'};
  if (($query eq "") && ($ENV{'REQUEST_METHOD'} eq "GET")) {
    $query = $HomePage;  # Allow caching of home page.
  }
  if (!($query =~ /^$LinkPattern$/)) {
    if (!($FreeLinks && ($query =~ /^$FreeLinkPattern$/))) {
      return 0;  # Only use cache for simple links
    }
  }              
  $idFile = &GetHtmlCacheFile($query);
  if (-f $idFile) {
    local $/ = undef;   # Read complete files
    open(INFILE, "<$idFile") or return 0;
    $text = <INFILE>;
    close INFILE;
    print $text; 
    return 1;    
  }
  return 0;      
}                

UseModWiki | DoCacheBrowse | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited March 14, 2005 1:51 am by user-10cmeae.cable.mindspring.com (diff)
Search: