[memcached] bradfitz, r516: noise cleanup, prior to using shipit

commits at code.sixapart.com commits at code.sixapart.com
Tue Apr 17 06:45:25 UTC 2007


noise cleanup, prior to using shipit



_U  trunk/api/perl/
U   trunk/api/perl/MANIFEST
A   trunk/api/perl/MANIFEST.SKIP
U   trunk/api/perl/dev/cons-hash.pl
A   trunk/api/perl/dev/minibench.pl



Property changes on: trunk/api/perl
___________________________________________________________________
Name: svn:ignore
   + META.yml
pm_to_blib
blib
Makefile



Modified: trunk/api/perl/MANIFEST
===================================================================
--- trunk/api/perl/MANIFEST	2007-04-17 00:59:12 UTC (rev 515)
+++ trunk/api/perl/MANIFEST	2007-04-17 06:45:24 UTC (rev 516)
@@ -4,6 +4,7 @@
 Makefile.PL
 README
 MANIFEST
+MANIFEST.SKIP
 TODO
 t/use.t
 t/all.t

Added: trunk/api/perl/MANIFEST.SKIP
===================================================================
--- trunk/api/perl/MANIFEST.SKIP	2007-04-17 00:59:12 UTC (rev 515)
+++ trunk/api/perl/MANIFEST.SKIP	2007-04-17 06:45:24 UTC (rev 516)
@@ -0,0 +1,24 @@
+^dev/
+
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+,v$
+\B\.svn\b
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib$
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#

Modified: trunk/api/perl/dev/cons-hash.pl
===================================================================
--- trunk/api/perl/dev/cons-hash.pl	2007-04-17 00:59:12 UTC (rev 515)
+++ trunk/api/perl/dev/cons-hash.pl	2007-04-17 06:45:24 UTC (rev 516)
@@ -53,8 +53,8 @@
         my $s1 = $set->target_of_bucket($rand);
         my $s2 = $set2->target_of_bucket($rand);
         $tran{"$s1-$s2"}++;
-        $tran{"was-$s1"}++;
-        $tran{"now-$s2"}++;
+        $tran{"$s1-"}++;
+        $tran{"-$s2"}++;
     }
 
     print Dumper(\%tran);

Added: trunk/api/perl/dev/minibench.pl
===================================================================
--- trunk/api/perl/dev/minibench.pl	2007-04-17 00:59:12 UTC (rev 515)
+++ trunk/api/perl/dev/minibench.pl	2007-04-17 06:45:24 UTC (rev 516)
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More;
+use Cache::Memcached;
+use IO::Socket::INET;
+
+my $testaddr = "127.0.0.1:11211";
+my $msock = IO::Socket::INET->new(PeerAddr => $testaddr,
+                                  Timeout  => 3);
+if ($msock) {
+    plan tests => 9;
+} else {
+    plan skip_all => "No memcached instance running at $testaddr\n";
+    exit 0;
+}
+
+my $keys = 800;
+
+my $memd = Cache::Memcached->new({
+#    servers   => [ $testaddr, $testaddr ],
+    servers   => [ $testaddr ],
+    namespace => "Cache::Memcached::t/$$/" . (time() % 100) . "/",
+});
+
+my %correct;
+for my $num (1..$keys) {
+    $correct{"key$num"} = "key$num " . ("-" x ($num * 1)); # 1 was 50
+    $memd->set("key$num", $correct{"key$num"})
+        or die "Failed to init $num";
+}
+
+srand(1);
+my $to = 3000; # was 3000
+for (1..$to) {
+    warn "$_ / $to\n" if $_ % 100 == 0;
+    my @multi = map { "key$_" } map { int(rand($keys * 2)) + 1 } (1..40);
+    my $get = $memd->get_multi(@multi);
+    #use Data::Dumper;
+    #print Dumper(\@multi, $get);
+    for (0..4) {  # was 4
+        my $k = $multi[$_];
+        die "no match for '$k': $get->{$k} vs $correct{$k}" unless $get->{$k} eq $correct{$k};
+    }
+}
+
+
+__END__
+
+ok($memd->set("key1", "val1"), "set succeeded");
+
+is($memd->get("key1"), "val1", "get worked");
+ok(! $memd->add("key1", "val-replace"), "add properly failed");
+ok($memd->add("key2", "val2"), "add worked on key2");
+is($memd->get("key2"), "val2", "get worked");
+
+ok($memd->replace("key2", "val-replace"), "replace worked");
+ok(! $memd->replace("key-noexist", "bogus"), "replace failed");
+
+my $stats = $memd->stats;
+ok($stats, "got stats");
+is(ref $stats, "HASH", "is a hashref");
+
+
+


Property changes on: trunk/api/perl/dev/minibench.pl
___________________________________________________________________
Name: svn:executable
   + *




More information about the memcached-commits mailing list