[LON-CAPA-cvs] cvs: loncom(version_2_3_X) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 17 Mar 2007 04:13:08 -0000
albertel Sat Mar 17 00:13:08 2007 EDT
Modified files: (Branch: version_2_3_X)
/loncom/lonnet/perl lonnet.pm
Log:
- backport 1.849
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.824.2.2 loncom/lonnet/perl/lonnet.pm:1.824.2.3
--- loncom/lonnet/perl/lonnet.pm:1.824.2.2 Thu Jan 25 16:45:44 2007
+++ loncom/lonnet/perl/lonnet.pm Sat Mar 17 00:13:06 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.824.2.2 2007/01/25 21:45:44 albertel Exp $
+# $Id: lonnet.pm,v 1.824.2.3 2007/03/17 04:13:06 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -990,10 +990,16 @@
my %accessed;
my $kicks=0;
my $hits=0;
+sub make_key {
+ my ($name,$id) = @_;
+ if (length($id) > 200) { $id=length($id).':'.&Digest::MD5::md5_hex($id); }
+ return &escape($name.':'.$id);
+}
+
sub devalidate_cache_new {
my ($name,$id,$debug) = @_;
if ($debug) { &Apache::lonnet::logthis("deleting $name:$id"); }
- $id=&escape($name.':'.$id);
+ $id=&make_key($name,$id);
$memcache->delete($id);
delete($remembered{$id});
delete($accessed{$id});
@@ -1001,7 +1007,7 @@
sub is_cached_new {
my ($name,$id,$debug) = @_;
- $id=&escape($name.':'.$id);
+ $id=&make_key($name,$id);
if (exists($remembered{$id})) {
if ($debug) { &Apache::lonnet::logthis("Earyl return $id of $remembered{$id} "); }
$accessed{$id}=[&gettimeofday()];
@@ -1024,7 +1030,7 @@
sub do_cache_new {
my ($name,$id,$value,$time,$debug) = @_;
- $id=&escape($name.':'.$id);
+ $id=&make_key($name,$id);
my $setvalue=$value;
if (!defined($setvalue)) {
$setvalue='__undef__';