[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm rat lonuserstate.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 19 Sep 2003 18:20:36 -0000
albertel Fri Sep 19 14:20:36 2003 EDT
Modified files:
/rat lonuserstate.pm
/loncom/lonnet/perl lonnet.pm
Log:
- titlecache now uses the common cahcing infrastructure
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.59 rat/lonuserstate.pm:1.60
--- rat/lonuserstate.pm:1.59 Fri Jun 20 14:57:58 2003
+++ rat/lonuserstate.pm Fri Sep 19 14:20:35 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Construct and maintain state and binary representation of course for user
#
-# $Id: lonuserstate.pm,v 1.59 2003/06/20 18:57:58 albertel Exp $
+# $Id: lonuserstate.pm,v 1.60 2003/09/19 18:20:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -120,12 +120,12 @@
$hash{'kind_'.$rid}='res';
$hash{'title_'.$rid}=$token->[2]->{'title'};
my $turi=$token->[2]->{'src'};
- $Apache::lonnet::titlecache{
- &Apache::lonnet::symbclean(
- &Apache::lonnet::declutter($uri).'___'.
- $token->[2]->{'id'}.'___'.
- &Apache::lonnet::declutter($turi))}=
- [$token->[2]->{'title'},time];
+ &Apache::lonnet::do_cache(\%Apache::lonnet::titlecache,
+ &Apache::lonnet::symbclean(
+ &Apache::lonnet::declutter($uri).'___'.
+ $token->[2]->{'id'}.'___'.
+ &Apache::lonnet::declutter($turi)),
+ $token->[2]->{'title'});
unless ($ispage) {
$turi=~/\.(\w+)$/;
my $embstyle=&Apache::loncommon::fileembstyle($1);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.418 loncom/lonnet/perl/lonnet.pm:1.419
--- loncom/lonnet/perl/lonnet.pm:1.418 Fri Sep 19 12:54:12 2003
+++ loncom/lonnet/perl/lonnet.pm Fri Sep 19 14:20:35 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.418 2003/09/19 16:54:12 albertel Exp $
+# $Id: lonnet.pm,v 1.419 2003/09/19 18:20:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3806,13 +3806,8 @@
unless ($urlsymb) { $urlsymb=$ENV{'request.filename'}; }
return &metadata($urlsymb,'title');
}
- if ($titlecache{$symb}) {
- if (time < ($titlecache{$symb}[1] + 600)) {
- return $titlecache{$symb}[0];
- } else {
- delete($titlecache{$symb});
- }
- }
+ my ($result,$cached)=&is_cached(\%titlecache,$symb,600);
+ if (defined($cached)) { return $result; }
my ($map,$resid,$url)=&decode_symb($symb);
my $title='';
my %bighash;
@@ -3824,8 +3819,7 @@
}
$title=~s/\&colon\;/\:/gs;
if ($title) {
- $titlecache{$symb}=[$title,time];
- return $title;
+ return &do_cache(\%titlecache,$symb,$title);
} else {
return &metadata($urlsymb,'title');
}