IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

clean up memcached support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 );
Note: See TracChangeset for help on using the changeset viewer.