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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 01 Sep 2005 05:07:37 -0000


albertel		Thu Sep  1 01:07:37 2005 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - add a means to devalidate items in getsection cache
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.651 loncom/lonnet/perl/lonnet.pm:1.652
--- loncom/lonnet/perl/lonnet.pm:1.651	Wed Aug 31 04:25:16 2005
+++ loncom/lonnet/perl/lonnet.pm	Thu Sep  1 01:07:35 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.651 2005/08/31 08:25:16 albertel Exp $
+# $Id: lonnet.pm,v 1.652 2005/09/01 05:07:35 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -767,6 +767,13 @@
 }
 
 # ------------------------------------- Find the section of student in a course
+sub devalidate_getsection_cache {
+    my ($udom,$unam,$courseid)=@_;
+    $courseid=~s/\_/\//g;
+    $courseid=~s/^(\w)/\/$1/;
+    my $hashid="$udom:$unam:$courseid";
+    &devalidate_cache_new('getsection',$hashid);
+}
 
 sub getsection {
     my ($udom,$unam,$courseid)=@_;
@@ -3767,6 +3774,8 @@
 		   $cdom,$cnum);
     unless (($reply eq 'ok') || ($reply eq 'delayed')) {
 	return 'error: '.$reply;
+    } else {
+	&devalidate_getsection_cache($udom,$uname,$cid);
     }
     # Add student role to user
     my $uurl='/'.$cid;