Steffen Müller > IPC-ConcurrencyLimit-Lock-MySQL-0.03 > IPC::ConcurrencyLimit::Lock::MySQL

Download:
IPC-ConcurrencyLimit-Lock-MySQL-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.03   Source  

NAME ^

IPC::ConcurrencyLimit::Lock::MySQL - Locking via MySQL GET_LOCK

SYNOPSIS ^

  use IPC::ConcurrencyLimit;

DESCRIPTION ^

This locking strategy uses MySQL's GET_LOCK to implement locking across multiple hosts.

METHODS ^

new

Given a hash ref with options, attempts to obtain a lock in the pool. On success, returns the lock object, otherwise undef.

Required parameters:

lock_name

The name prefix for the named GET_LOCK locks to use. Make sure this doesn't collide with any other locks.

make_new_dbh

A code reference that, when called, will return a NEW database handle for use in locking. If it returns a handle that is used for other purposes as well, there can be strange action at a distance since MySQL allow exactly one lock at a time per connection. If a second GET_LOCK is issued for the same connection, the old lock will be silently released!

max_procs

The maximum no. of locks (and thus usually processes) to allow at one time.

Options:

timeout

The time-out in seconds when trying to obtain a lock. Defaults to 0, non-blocking.

AUTHOR ^

Steffen Mueller, smueller@cpan.org

ACKNOWLEDGMENT ^

This module was originally developed for booking.com. With approval from booking.com, this module was generalized and put on CPAN, for which the author would like to express his gratitude.

COPYRIGHT AND LICENSE ^

 (C) 2011, 2013 Steffen Mueller. All rights reserved.
 
 This code is available under the same license as Perl version
 5.8.1 or higher.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
syntax highlighting: