[LON-CAPA-cvs] cvs: loncom(version_1_3_X_memcached) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sun, 13 Feb 2005 22:12:35 -0000
albertel Sun Feb 13 17:12:35 2005 EDT
Modified files: (Branch: version_1_3_X_memcached)
/loncom/lonnet/perl lonnet.pm
Log:
- Hrrm, might be correctish in some situations
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.587.2.3.2.1 loncom/lonnet/perl/lonnet.pm:1.587.2.3.2.2
--- loncom/lonnet/perl/lonnet.pm:1.587.2.3.2.1 Thu Feb 10 03:16:31 2005
+++ loncom/lonnet/perl/lonnet.pm Sun Feb 13 17:12:34 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.587.2.3.2.1 2005/02/10 08:16:31 albertel Exp $
+# $Id: lonnet.pm,v 1.587.2.3.2.2 2005/02/13 22:12:34 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -924,6 +924,7 @@
}
sub save_cache {
+ &purge_remembered();
if ($disk_caching_disabled) { return; }
my ($cache,$name,$id);
foreach $name (keys(%do_save)) {
@@ -1030,6 +1031,8 @@
my $to_remember=10;
my %remembered;
my %accessed;
+my $kicks=0;
+my $hits=0;
sub is_cached_new {
my ($cache,$name,$id,$debug) = @_;
$debug=0;
@@ -1037,6 +1040,7 @@
if (exists($remembered{$id})) {
if ($debug) { &Apache::lonnet::logthis("Earyl return $id of $remembered{$id} "); }
$accessed{$id}=[&gettimeofday()];
+ $hits++;
return ($remembered{$id},1);
}
my $value = $cache->get($id);
@@ -1066,7 +1070,6 @@
return $value;
}
-my $kicks=0;
sub make_room {
my ($id,$value)=@_;
my $debug=0;
@@ -1088,6 +1091,11 @@
return;
}
+sub purge_remembered {
+ &logthis("Tossing ".scalar(keys(%remembered)));
+ undef(%remembered);
+ undef(%accessed);
+}
# ------------------------------------- Read an entry from a user's environment
sub userenvironment {
@@ -5656,6 +5664,7 @@
&logthis(sprintf("%-20s is %s",'%resversioncache',length(&freeze(\%resversioncache))));
&logthis(sprintf("%-20s is %s",'%remembered',length(&freeze(\%remembered))));
&logthis(sprintf("%-20s is %s",'kicks',$kicks));
+ &logthis(sprintf("%-20s is %s",'hits',$hits));
&flushcourselogs();
&logthis("Shutting down");
return DONE;