IPC-ConcurrencyLimit-Lock-Redis
view release on metacpan or search on metacpan
lib/IPC/ConcurrencyLimit/Lock/Redis.pm view on Meta::CPAN
local $@;
my $self = shift;
$self->_release_lock();
}
# This is so ugly because we compile slightly different code depending on whether
# we're running on a perl that can do big-endian-forced-quads or not.
# FIXME Will work on 64bit perls only. Implementation for 32bit integers welcome.
# FIXME is this worth it or should it just do a run-time perl version check like heartbeat()?
eval(<<'PRE' . ($] ge '5.010' ? <<'NEW_PERL' : <<'OLD_PERL') . <<'POST')
sub clear_old_locks {
my ($class, $redis_conn, $key_name, $cutoff) = @_;
my %hash = $redis_conn->hgetall($key_name);
return if not keys(%hash);
my $ncleared = 0;
foreach my $lockid (keys %hash) {
PRE
my ($quad) = unpack("Q>", $hash{$lockid});
$quad -= $quad % 16; # 60 bit only
( run in 0.556 second using v1.01-cache-2.11-cpan-cc502c75498 )