[Rt-commit] r6304 - in IPC-PubSub: lib/IPC

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


Author: audreyt
Date: Thu Oct 26 21:07:06 2006
New Revision: 6304

Modified:
   IPC-PubSub/Changes
   IPC-PubSub/lib/IPC/PubSub.pm

Log:
* This be 0.21.

Modified: IPC-PubSub/Changes
==============================================================================
--- IPC-PubSub/Changes	(original)
+++ IPC-PubSub/Changes	Thu Oct 26 21:07:06 2006
@@ -1,3 +1,8 @@
+[Changes for 0.21 - 2006-10-26]
+
+* Speed up ->modify calls for the Memcached backend.
+* Normalized internal keys for channels, messages and data so they can't clash.
+
 [Changes for 0.20 - 2006-10-25]
 
 * Memcached: Remove the debug messages accidentally left in ->lock and ->unlock.

Modified: IPC-PubSub/lib/IPC/PubSub.pm
==============================================================================
--- IPC-PubSub/lib/IPC/PubSub.pm	(original)
+++ IPC-PubSub/lib/IPC/PubSub.pm	Thu Oct 26 21:07:06 2006
@@ -1,5 +1,5 @@
 package IPC::PubSub;
-$IPC::PubSub::VERSION = '0.20';
+$IPC::PubSub::VERSION = '0.21';
 
 use 5.006;
 use strict;
@@ -98,12 +98,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');
+
 =head1 DESCRIPTION
 
 This module provides a simple API for publishing messages to I<channels>


More information about the Rt-commit mailing list