[LON-CAPA-cvs] cvs: loncom(version_1_3_X_memcached) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 14 Feb 2005 02:20:27 -0000
albertel Sun Feb 13 21:20:27 2005 EDT
Modified files: (Branch: version_1_3_X_memcached)
/loncom/lonnet/perl lonnet.pm
Log:
- increase the effectivness of the %remebered,
- delete things if they are devalidated
- add things if we just discovered no need to have to go fetch it if we have it
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.587.2.3.2.4 loncom/lonnet/perl/lonnet.pm:1.587.2.3.2.5
--- loncom/lonnet/perl/lonnet.pm:1.587.2.3.2.4 Sun Feb 13 21:17:51 2005
+++ loncom/lonnet/perl/lonnet.pm Sun Feb 13 21:20:26 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.587.2.3.2.4 2005/02/14 02:17:51 albertel Exp $
+# $Id: lonnet.pm,v 1.587.2.3.2.5 2005/02/14 02:20:26 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1022,17 +1022,20 @@
# &logthis("load_cache_item $name took ".(&Time::HiRes::time()-$starttime));
}
-sub devalidate_cache_new {
- my ($name,$id) = @_;
- if (1) { &Apache::lonnet::logthis("deleting $name:$id"); }
- $memcache->delete(&escape($name.':'.$id));
-}
-
my $to_remember=10;
my %remembered;
my %accessed;
my $kicks=0;
my $hits=0;
+sub devalidate_cache_new {
+ my ($name,$id) = @_;
+ if (0) { &Apache::lonnet::logthis("deleting $name:$id"); }
+ $id=&escape($name.':'.$id);
+ $memcache->delete($id);
+ delete($remembered{$id});
+ delete($accessed{$id});
+}
+
sub is_cached_new {
my ($name,$id,$debug) = @_;
$debug=0;
@@ -1067,6 +1070,7 @@
}
if ($debug) { &Apache::lonnet::logthis("Setting $id to $value"); }
$memcache->set($id,$setvalue,300);
+ &make_room($id,$value);
return $value;
}