Author: timbo
Date: Mon Nov 26 14:25:33 2007
New Revision: 10314
Modified:
dbi/trunk/Changes
dbi/trunk/lib/DBD/Gofer/Transport/Base.pm
dbi/trunk/lib/DBI/Util/CacheMemory.pm
Log:
Fixed DBI::Util::CacheMemory->new to not clear the cache.
Improved some trace messages.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Mon Nov 26 14:25:33 2007
@@ -44,10 +44,11 @@
=head2 Changes in DBI ...
+ Fixed DBI::Util::CacheMemory->new to not clear the cache.
Expanded DBI::DBD docs for driver authors thanks to Martin Evans.
- Improvements to t/80proxy.t test script.
- Improvements to t/85gofer.t test script thanks to Stig.
- Improvements to t/10examp.t test script thanks to David Cantrell.
+ Enhanced t/80proxy.t test script.
+ Enhanced t/85gofer.t test script thanks to Stig.
+ Enhanced t/10examp.t test script thanks to David Cantrell.
Gofer changes:
track_recent now also keeps track of N most recent errors.
Modified: dbi/trunk/lib/DBD/Gofer/Transport/Base.pm
==============================================================================
--- dbi/trunk/lib/DBD/Gofer/Transport/Base.pm (original)
+++ dbi/trunk/lib/DBD/Gofer/Transport/Base.pm Mon Nov 26 14:25:33 2007
@@ -66,7 +66,7 @@
if (my $trace = $self->trace) {
$self->_dump("cached response found for ".ref($request),
$request);
$self->_dump("cached response is ".ref($response),
$response);
- $self->trace_msg("transmit_request is returing a response
from cache\n");
+ $self->trace_msg("transmit_request is returning a response
from cache $go_cache\n");
}
++$self->{cache_hit};
return $response;
@@ -250,7 +250,7 @@
warn "No request_cache_key" if !$request_cache_key;
if ($frozen_response && $request_cache_key) {
- $self->trace_msg("receive_response added response to cache\n");
+ $self->trace_msg("receive_response added response to cache
$go_cache\n");
eval { $go_cache->set($request_cache_key, $frozen_response) };
warn $@ if $@;
++$self->{cache_store};
Modified: dbi/trunk/lib/DBI/Util/CacheMemory.pm
==============================================================================
--- dbi/trunk/lib/DBI/Util/CacheMemory.pm (original)
+++ dbi/trunk/lib/DBI/Util/CacheMemory.pm Mon Nov 26 14:25:33 2007
@@ -66,12 +66,10 @@
sub new {
my ($class, %options ) = @_;
- $options{namespace} ||= 'Default';
- my $self = bless {
- #_cache => \%cache, # can be handy for debugging/dumping
- %options,
- } => $class;
- $self->clear; # init
+ my $namespace = $options{namespace} ||= 'Default';
+ #$options{_cache} = \%cache; # can be handy for debugging/dumping
+ my $self = bless \%options => $class;
+ $cache{ $namespace } ||= {}; # init - ensure it exists
return $self;
}