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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 05 Dec 2002 23:51:05 -0000


albertel		Thu Dec  5 18:51:05 2002 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - got the logic right, and now using students env to cache, faster and cleaner
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.308 loncom/lonnet/perl/lonnet.pm:1.309
--- loncom/lonnet/perl/lonnet.pm:1.308	Thu Dec  5 18:27:46 2002
+++ loncom/lonnet/perl/lonnet.pm	Thu Dec  5 18:51:05 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.308 2002/12/05 23:27:46 albertel Exp $
+# $Id: lonnet.pm,v 1.309 2002/12/05 23:51:05 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -81,7 +81,7 @@
    %libserv %pr %prp %metacache %packagetab %titlecache 
    %courselogs %accesshash $processmarker $dumpcount 
    %coursedombuf %coursehombuf %courseresdatacache 
-   %studentresdatacache %domaindescription);
+   %domaindescription);
 use IO::Socket;
 use GDBM_File;
 use Apache::Constants qw(:common :http);
@@ -2851,8 +2851,9 @@
 # ----------------------------------------------------------- first, check user
 	    #most student don't have any data set, check if there is some data
             #every thirty minutes
-	    if (!exists($studentresdatacache{$uname.'_'.$udom})
-		|| $studentresdatacache{$uname.'_'.$udom} > (time+1800)) {
+	    if (!
+		(exists($ENV{'cache.studentresdata'})
+		    && (($ENV{'cache.studentresdata'}+1800) > time))) {
 		my %resourcedata=&get('resourcedata',
 				      [$courselevelr,$courselevelm,$courselevel],
 				      $udom,$uname);
@@ -2871,7 +2872,9 @@
 				 $uname." at ".$udom.": ".
 				 $tmp."</font>");
 		    } elsif ($tmp=~/error:No such file/) {
-			$studentresdatacache{$uname.'_'.$udom}=time;
+			$ENV{'cache.studentresdata'}=time;
+			&appenv(('cache.studentresdata'=>
+				 $ENV{'cache.studentresdata'}));
 		    } elsif ($tmp =~ /^(con_lost|no_such_host)/) {
 			return $tmp;
 		    }