Index: trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 24370)
+++ trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 24372)
@@ -516,4 +516,7 @@
             }
 
+            $self->cache->delete($key->path) if defined $self->cache;
+            $self->cache->set($newkey->path, 1) if defined $self->cache;
+
             $db->commit;
             $log->debug("commit");
@@ -1930,5 +1933,5 @@
     my $cached = $self->cache->get($key->path) if defined $self->cache;
     if (defined $cached) {
-        $log->debug( "key $key found in cache" );
+        $log->debug( "key $key found in cache as ", $key->path );
         $log->debug( "leaving" );
         return 1;
@@ -1956,5 +1959,5 @@
     	# add key to cache
         $self->cache->set($key->path, 1) if defined $self->cache;
-        $log->debug( "key added to cache" );
+        $log->debug( "key added to cache as ", $key->path );
         $log->debug( "leaving" );
         return 1;
@@ -1970,8 +1973,10 @@
 sub _is_valid_volume_name
 {
-    my ($self, $key, $vol_name) = @_;
+    my $self = shift;
 
     my $log = $self->log;
     $log->debug( "entered - @_" );
+
+    my ($key, $vol_name) = @_;
 
     my $sql = $self->sql;
Index: trunk/Nebulous-Server/lib/Test/Nebulous.pm
===================================================================
--- trunk/Nebulous-Server/lib/Test/Nebulous.pm	(revision 24370)
+++ trunk/Nebulous-Server/lib/Test/Nebulous.pm	(revision 24372)
@@ -11,4 +11,5 @@
 use base qw( Exporter );
 
+use Cache::Memcached;
 use DBI;
 use File::Path qw( mkpath rmtree );
@@ -16,9 +17,10 @@
 use Nebulous::Server::SQL;
 
-our @EXPORT = qw( $NEB_DB $NEB_USER $NEB_PASS );
+our @EXPORT = qw( $NEB_DB $NEB_USER $NEB_PASS $NEB_MEMCACHED_SERVERS);
 
 our $NEB_DB     = $ENV{'NEB_DB'}   || "DBI:mysql:database=test:host=localhost";
 our $NEB_USER   = $ENV{'NEB_USER'} || "test";
 our $NEB_PASS   = $ENV{'NEB_PASS'} || '';
+our $NEB_MEMCACHED_SERVERS = ['127.0.0.1:11211'];
 
 my $dbh = DBI->connect( $NEB_DB, $NEB_USER, $NEB_PASS );
@@ -83,4 +85,18 @@
 
 sub cleanup {
+    # memcached needs to be emptied between test runs
+        Cache::Memcached->new(servers => $NEB_MEMCACHED_SERVERS)->flush_all;
+    # if flush_all() turns out to be useless as feared
+#   my $memd = Cache::Memcached->new(servers => $NEB_MEMCACHED_SERVERS);
+#   my $query = $dbh->prepare("SELECT ext_id FROM storage_object");
+#   if ($query->execute) {
+#        while (my $row = $query->fetchrow_hashref) {
+#            my $ext_id = $row->{ext_id};
+#            warn "found key $ext_id\n" if $memd->get($ext_id);
+#            warn "deleted $ext_id\n" if $memd->delete($ext_id);
+#        }
+#   }
+#   $query->finish;
+
     foreach my $statement (@{ $sql->get_db_clear }) {
         $dbh->do( $statement );
Index: trunk/Nebulous-Server/t/05_server_replicate_object.t
===================================================================
--- trunk/Nebulous-Server/t/05_server_replicate_object.t	(revision 24370)
+++ trunk/Nebulous-Server/t/05_server_replicate_object.t	(revision 24372)
@@ -24,4 +24,5 @@
     dbuser      => $NEB_USER,
     dbpasswd    => $NEB_PASS,
+    memcached_servers => $NEB_MEMCACHED_SERVERS,
 );
 
