[Rt-commit] r6300 - in IPC-PubSub: . lib/IPC lib/IPC/PubSub/Cache

audreyt at bestpractical.com audreyt at bestpractical.com
Wed Oct 25 12:49:09 EDT 2006


Author: audreyt
Date: Wed Oct 25 12:49:08 2006
New Revision: 6300

Removed:
   IPC-PubSub/inc/.author/
Modified:
   IPC-PubSub/Changes
   IPC-PubSub/MANIFEST
   IPC-PubSub/META.yml
   IPC-PubSub/Makefile
   IPC-PubSub/lib/IPC/PubSub.pm
   IPC-PubSub/lib/IPC/PubSub/Cache/Memcached.pm

Log:
* This be 0.11.

Modified: IPC-PubSub/Changes
==============================================================================
--- IPC-PubSub/Changes	(original)
+++ IPC-PubSub/Changes	Wed Oct 25 12:49:08 2006
@@ -1,3 +1,8 @@
+[Changes for 0.11 - 2006-10-25]
+
+* The Memcached backend now takes a namespace parameter to avoid collision.
+* The ->lock, ->unlock, ->fetch, ->store APIs in IPC::PubSub now works again.
+
 [Changes for 0.10 - 2006-10-25]
 
 * Renamed from MessageBus.pm to IPC::PubSub.

Modified: IPC-PubSub/MANIFEST
==============================================================================
--- IPC-PubSub/MANIFEST	(original)
+++ IPC-PubSub/MANIFEST	Wed Oct 25 12:49:08 2006
@@ -20,6 +20,5 @@
 lib/IPC/PubSub/Subscriber.pm
 Makefile.PL
 MANIFEST			This list of files
-META.yml
 README
 t/basic.t

Modified: IPC-PubSub/META.yml
==============================================================================
--- IPC-PubSub/META.yml	(original)
+++ IPC-PubSub/META.yml	Wed Oct 25 12:49:08 2006
@@ -13,4 +13,4 @@
   DBM::Deep: 0
   Data::UUID: 0
   perl: 5.005
-version: 0.10
+version: 0.11

Modified: IPC-PubSub/Makefile
==============================================================================
--- IPC-PubSub/Makefile	(original)
+++ IPC-PubSub/Makefile	Wed Oct 25 12:49:08 2006
@@ -19,7 +19,7 @@
 #     PL_FILES => {  }
 #     PREREQ_PM => { DBM::Deep=>q[0], Class::Accessor::Fast=>q[0], Data::UUID=>q[0] }
 #     SIGN => q[1]
-#     VERSION => q[0.10]
+#     VERSION => q[0.11]
 #     dist => { PREOP=>q[$(PERL) -I. -MModule::Install::Admin -e "dist_preop(q($(DISTVNAME)))"] }
 
 # --- MakeMaker post_initialize section:
@@ -60,11 +60,11 @@
 DFSEP = $(DIRFILESEP)
 NAME = IPC::PubSub
 NAME_SYM = IPC_PubSub
-VERSION = 0.10
+VERSION = 0.11
 VERSION_MACRO = VERSION
-VERSION_SYM = 0_10
+VERSION_SYM = 0_11
 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
-XS_VERSION = 0.10
+XS_VERSION = 0.11
 XS_VERSION_MACRO = XS_VERSION
 XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
 INST_ARCHLIB = blib/arch
@@ -280,7 +280,7 @@
 DIST_CP = best
 DIST_DEFAULT = tardist
 DISTNAME = IPC-PubSub
-DISTVNAME = IPC-PubSub-0.10
+DISTVNAME = IPC-PubSub-0.11
 
 
 # --- MakeMaker macro section:
@@ -785,7 +785,7 @@
 # --- MakeMaker ppd section:
 # Creates a PPD (Perl Package Description) for a binary distribution.
 ppd:
-	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,10,0,0">' > $(DISTNAME).ppd
+	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,11,0,0">' > $(DISTNAME).ppd
 	$(NOECHO) $(ECHO) '    <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
 	$(NOECHO) $(ECHO) '    <ABSTRACT>Interprocess Publish/Subscribe channels</ABSTRACT>' >> $(DISTNAME).ppd
 	$(NOECHO) $(ECHO) '    <AUTHOR>Audrey Tang &lt;cpan at audreyt.org&gt;</AUTHOR>' >> $(DISTNAME).ppd

Modified: IPC-PubSub/lib/IPC/PubSub.pm
==============================================================================
--- IPC-PubSub/lib/IPC/PubSub.pm	(original)
+++ IPC-PubSub/lib/IPC/PubSub.pm	Wed Oct 25 12:49:08 2006
@@ -1,5 +1,5 @@
 package IPC::PubSub;
-$IPC::PubSub::VERSION = '0.10';
+$IPC::PubSub::VERSION = '0.11';
 
 use 5.005;
 use strict;
@@ -32,10 +32,10 @@
     IPC::PubSub::Subscriber->new($self->_cache, @_ ? @_ : '');
 }
 
-sub fetch   { (+shift)->fetch(@_)   }
-sub store   { (+shift)->store(@_)   }
-sub lock    { (+shift)->lock(@_)    }
-sub unlock  { (+shift)->unlock(@_)  }
+sub fetch   { (+shift)->_cache->fetch(@_)   }
+sub store   { (+shift)->_cache->store(@_)   }
+sub lock    { (+shift)->_cache->lock(@_)    }
+sub unlock  { (+shift)->_cache->unlock(@_)  }
 
 1;
 

Modified: IPC-PubSub/lib/IPC/PubSub/Cache/Memcached.pm
==============================================================================
--- IPC-PubSub/lib/IPC/PubSub/Cache/Memcached.pm	(original)
+++ IPC-PubSub/lib/IPC/PubSub/Cache/Memcached.pm	Wed Oct 25 12:49:08 2006
@@ -4,21 +4,25 @@
 use Cache::Memcached;
 
 sub new {
-    my $class = shift;
-    my $config = shift || $class->default_config;
+    my $class       = shift;
+    my $namespace   = shift || $class;
+    my $config      = shift || $class->default_config($namespace);
     my $mem = Cache::Memcached->new($config);
     bless(\$mem, $class);
 }
 
 sub default_config {
+    my ($class, $namespace) = @_;
     return {
-        servers => ['127.0.0.1:11211'],
-        debug => 0
+        servers     => ['127.0.0.1:11211'],
+        debug       => 0,
+        namespace   => $namespace,
     };
 }
 
 sub fetch {
     my $self = shift;
+    die "Rejecting insanity" if @_ > 100;
     values(%{$$self->get_multi(@_)});
 }
 
@@ -34,14 +38,18 @@
 
 sub lock {
     my ($self, $chan) = @_;
+    warn "trying to acquire lock: $chan\n";
     for my $i (1..10) {
         return if $$self->add("$chan#lock" => 1);
+        warn "contention: $chan\n";
+        return;
         sleep 1;
     }
 }
 
 sub unlock {
     my ($self, $chan) = @_;
+    warn "trying to release lock: $chan\n";
     $$self->delete("$chan#lock");
 }
 


More information about the Rt-commit mailing list