The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::Locker::Lock - a live resource lock

VERSION

version 1.103

PERL VERSION

This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

METHODS

new

Calling this method is a very, very stupid idea. This method is called by DBIx::Locker to create locks. Since you are not a locker, you should not call this method. Seriously.

  my $locker = DBIx::Locker::Lock->new(\%arg);

This returns a new lock.

  locker     - the locker creating the lock
  lock_id    - the id of the lock in the lock table
  expires    - the time (in epoch seconds) at which the lock will expire
  locked_by  - a hashref of identifying information
  lockstring - the string that was locked

locker

lock_id

locked_by

lockstring

These are accessors for data supplied to "new".

expires

This method returns the expiration time (as a unix timestamp) as provided to "new" -- unless expiration has been changed. Expiration can be changed by using this method as a mutator:

  # expire one hour from now, no matter what initial expiration was
  $lock->expires(time + 3600);

When updating the expiration time, if the given expiration time is not a valid unix time, or if the expiration cannot be updated, an exception will be raised.

guid

This method returns the lock's globally unique id.

is_locked

Method to see if the lock is active or not

unlock

This method unlocks the lock, deleting the semaphor record. This method is automatically called when locks are garbage collected.

AUTHOR

Ricardo SIGNES <cpan@semiotic.systems>

COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Ricardo SIGNES.

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