IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24372


Ignore:
Timestamp:
Jun 10, 2009, 3:30:24 PM (17 years ago)
Author:
jhoblitt
Message:

clean up memcached support

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r24369 r24372  
    516516            }
    517517
     518            $self->cache->delete($key->path) if defined $self->cache;
     519            $self->cache->set($newkey->path, 1) if defined $self->cache;
     520
    518521            $db->commit;
    519522            $log->debug("commit");
     
    19301933    my $cached = $self->cache->get($key->path) if defined $self->cache;
    19311934    if (defined $cached) {
    1932         $log->debug( "key $key found in cache" );
     1935        $log->debug( "key $key found in cache as ", $key->path );
    19331936        $log->debug( "leaving" );
    19341937        return 1;
     
    19561959        # add key to cache
    19571960        $self->cache->set($key->path, 1) if defined $self->cache;
    1958         $log->debug( "key added to cache" );
     1961        $log->debug( "key added to cache as ", $key->path );
    19591962        $log->debug( "leaving" );
    19601963        return 1;
     
    19701973sub _is_valid_volume_name
    19711974{
    1972     my ($self, $key, $vol_name) = @_;
     1975    my $self = shift;
    19731976
    19741977    my $log = $self->log;
    19751978    $log->debug( "entered - @_" );
     1979
     1980    my ($key, $vol_name) = @_;
    19761981
    19771982    my $sql = $self->sql;
  • trunk/Nebulous-Server/lib/Test/Nebulous.pm

    r19493 r24372  
    1111use base qw( Exporter );
    1212
     13use Cache::Memcached;
    1314use DBI;
    1415use File::Path qw( mkpath rmtree );
     
    1617use Nebulous::Server::SQL;
    1718
    18 our @EXPORT = qw( $NEB_DB $NEB_USER $NEB_PASS );
     19our @EXPORT = qw( $NEB_DB $NEB_USER $NEB_PASS $NEB_MEMCACHED_SERVERS);
    1920
    2021our $NEB_DB     = $ENV{'NEB_DB'}   || "DBI:mysql:database=test:host=localhost";
    2122our $NEB_USER   = $ENV{'NEB_USER'} || "test";
    2223our $NEB_PASS   = $ENV{'NEB_PASS'} || '';
     24our $NEB_MEMCACHED_SERVERS = ['127.0.0.1:11211'];
    2325
    2426my $dbh = DBI->connect( $NEB_DB, $NEB_USER, $NEB_PASS );
     
    8385
    8486sub cleanup {
     87    # memcached needs to be emptied between test runs
     88        Cache::Memcached->new(servers => $NEB_MEMCACHED_SERVERS)->flush_all;
     89    # if flush_all() turns out to be useless as feared
     90#   my $memd = Cache::Memcached->new(servers => $NEB_MEMCACHED_SERVERS);
     91#   my $query = $dbh->prepare("SELECT ext_id FROM storage_object");
     92#   if ($query->execute) {
     93#        while (my $row = $query->fetchrow_hashref) {
     94#            my $ext_id = $row->{ext_id};
     95#            warn "found key $ext_id\n" if $memd->get($ext_id);
     96#            warn "deleted $ext_id\n" if $memd->delete($ext_id);
     97#        }
     98#   }
     99#   $query->finish;
     100
    85101    foreach my $statement (@{ $sql->get_db_clear }) {
    86102        $dbh->do( $statement );
  • trunk/Nebulous-Server/t/05_server_replicate_object.t

    r24356 r24372  
    2424    dbuser      => $NEB_USER,
    2525    dbpasswd    => $NEB_PASS,
     26    memcached_servers => $NEB_MEMCACHED_SERVERS,
    2627);
    2728
  • trunk/Nebulous/t/conf/startup.pl.in

    r23934 r24372  
    1818my $config = Nebulous::Server::Config->new(
    1919    trace       => 'all',
     20    memcached_servers => ['127.0.0.1:11211'],
    2021);
    2122$config->add_db(
Note: See TracChangeset for help on using the changeset viewer.