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

audreyt at bestpractical.com audreyt at bestpractical.com
Thu Oct 26 21:38:59 EDT 2006


Author: audreyt
Date: Thu Oct 26 21:38:58 2006
New Revision: 6305

Modified:
   IPC-PubSub/META.yml
   IPC-PubSub/Makefile
   IPC-PubSub/README
   IPC-PubSub/lib/IPC/PubSub/Cache/Memcached.pm

Log:
* This be 0.21.

Modified: IPC-PubSub/META.yml
==============================================================================
--- IPC-PubSub/META.yml	(original)
+++ IPC-PubSub/META.yml	Thu Oct 26 21:38:58 2006
@@ -14,4 +14,4 @@
   Data::UUID: 0
   Time::HiRes: 0
   perl: 5.6.0
-version: 0.20
+version: 0.21

Modified: IPC-PubSub/Makefile
==============================================================================
--- IPC-PubSub/Makefile	(original)
+++ IPC-PubSub/Makefile	Thu Oct 26 21:38:58 2006
@@ -19,7 +19,7 @@
 #     PL_FILES => {  }
 #     PREREQ_PM => { DBM::Deep=>q[0], Time::HiRes=>q[0], Class::Accessor::Fast=>q[0], Data::UUID=>q[0] }
 #     SIGN => q[1]
-#     VERSION => q[0.20]
+#     VERSION => q[0.21]
 #     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.20
+VERSION = 0.21
 VERSION_MACRO = VERSION
-VERSION_SYM = 0_20
+VERSION_SYM = 0_21
 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
-XS_VERSION = 0.20
+XS_VERSION = 0.21
 XS_VERSION_MACRO = XS_VERSION
 XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
 INST_ARCHLIB = blib/arch
@@ -283,7 +283,7 @@
 DIST_CP = best
 DIST_DEFAULT = tardist
 DISTNAME = IPC-PubSub
-DISTVNAME = IPC-PubSub-0.20
+DISTVNAME = IPC-PubSub-0.21
 
 
 # --- MakeMaker macro section:
@@ -788,7 +788,7 @@
 # --- MakeMaker ppd section:
 # Creates a PPD (Perl Package Description) for a binary distribution.
 ppd:
-	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,20,0,0">' > $(DISTNAME).ppd
+	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,21,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/README
==============================================================================
--- IPC-PubSub/README	(original)
+++ IPC-PubSub/README	Thu Oct 26 21:38:58 2006
@@ -51,12 +51,22 @@
         print "Sub is in #moose" if $sub->channels->{'#moose'};
         print "Pub is in #moose" if $pub->channels->{'#moose'};
 
-        # Raw APIs to manipulate the cache
+        # Raw cache manipulation APIs (not advised; use ->modify instead)
         $bus->lock('channel');
         $bus->unlock('channel');
         my @timed_msgs = $bus->fetch('key1', 'key2', 'key3');
         $bus->store('key', 'value', time, 30);
 
+        # Atomic updating of cache content; $_ is stored back on the
+        # end of the callback.
+        my $rv = $bus->modify('key' => sub { delete $_->{foo} });
+
+        # Shorthand for $bus->modify('key' => sub { $_ = 'val' });
+        $bus->modify('key' => 'val');
+
+        # Shorthand for $bus->modify('key' => sub { $_ });
+        $bus->modify('key');
+
 DESCRIPTION
     This module provides a simple API for publishing messages to *channels*
     and for subscribing to them.

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	Thu Oct 26 21:38:58 2006
@@ -31,7 +31,12 @@
     my $self = shift;
     my $key  = shift;
     my $val  = shift;
-    return $$self->set("data:$key" => $val);
+    if (defined $val) {
+        $$self->set("data:$key" => $val);
+    }
+    else {
+        $$self->delete("data:$key");
+    }
 }
 
 sub fetch {


More information about the Rt-commit mailing list