[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 20 Sep 2004 20:11:16 -0000


albertel		Mon Sep 20 16:11:16 2004 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - fix up disk based caching so it works with the .file attribute
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.543 loncom/lonnet/perl/lonnet.pm:1.544
--- loncom/lonnet/perl/lonnet.pm:1.543	Mon Sep 20 15:54:47 2004
+++ loncom/lonnet/perl/lonnet.pm	Mon Sep 20 16:11:16 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.543 2004/09/20 19:54:47 albertel Exp $
+# $Id: lonnet.pm,v 1.544 2004/09/20 20:11:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -821,7 +821,7 @@
 }
 
 
-my $disk_caching_disabled=1;
+my $disk_caching_disabled=0;
 
 sub devalidate_cache {
     my ($cache,$id,$name) = @_;
@@ -927,6 +927,9 @@
 		eval <<'EVALBLOCK';
 		$hash{$id.'.time'}=$$cache{$id.'.time'};
 		$hash{$id}=freeze({'item'=>$$cache{$id}});
+		if (exists($$cache{$id.'.file'})) {
+		    $hash{$id.'.file'}=freeze({'item'=>$$cache{$id.'.file'}});
+		}
 EVALBLOCK
                 if ($@) {
 		    &logthis("<font color='red'>save_cache blew up :$@:$name</font>");
@@ -977,8 +980,14 @@
 	    } else {
 		if (($$cache{$id.'.time'}+$time) < time) {
 		    $$cache{$id.'.time'}=$hash{$id.'.time'};
-		    my $hashref=thaw($hash{$id});
-		    $$cache{$id}=$hashref->{'item'};
+		    {
+			my $hashref=thaw($hash{$id});
+			$$cache{$id}=$hashref->{'item'};
+		    }
+		    if (exists($hash{$id.'.file'})) {
+			my $hashref=thaw($hash{$id.'.file'});
+			$$cache{$id.'.file'}=$hashref->{'item'};
+		    }
 		}
 	    }
 EVALBLOCK