DBIx::Class::OptimisticLocking - Optimistic locking support for DBIx::Class

Optimistic locking is an alternative to using exclusive locks when you have the possibility of concurrent, conflicting updates in your database.  The basic principle is you allow any and all
clients to issue updates and rather than preemptively synchronizing all data modifications (which is what happens with exclusive locks) you are "optimistic" that updates won’t interfere with one
another and the updates will only fail when they do in fact interfere with one another.

Consider the following scenario (in timeline order, not in the same block of code):

	   my $order = $schema->resultset('Orders')->find(1);

	   # some other different, concurrent process loads the same object
	   my $other_order = $schema->resultset('Orders')->find(1);

	   $order->status('fraud review');
	   $other_order->status('processed');

	   $order->update; # this succeeds
	   $other_order->update; # this fails when using optimistic locking

Without optimistic locking (or exclusive locking), the example order would have two sequential updates issued with the second essentially erasing the results of the first.  With optimistic
locking, the second update (on $other_order) would fail.

This optimistic locking is typically done by adding additional restrictions to the "WHERE" clause of the "UPDATE" statement.  These additional restrictions ensure the data is still in the
expected state before applying the update.  This DBIx::Class::OptimisticLocking component provides a few different strategies for providing this functionality.

INSTALLATION

To install this module, run the following commands:

	perl Makefile.PL
	make
	make test
	make install

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the
perldoc command.

    perldoc DBIx::Class::OptimisticLocking

You can also look for information at:

    RT, CPAN's request tracker
        http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-OptimisticLocking

    AnnoCPAN, Annotated CPAN documentation
        http://annocpan.org/dist/DBIx-Class-OptimisticLocking

    CPAN Ratings
        http://cpanratings.perl.org/d/DBIx-Class-OptimisticLocking

    Search CPAN
        http://search.cpan.org/dist/DBIx-Class-OptimisticLocking/


COPYRIGHT AND LICENCE

Copyright (C) 2008 Brian Phillips

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.