Sha256: 8561a04efbc3a53589b80ffc085df377d9d2b9be0329b18669ec01edf9b8beb7

Contents?: true

Size: 201 Bytes

Versions: 25

Compression:

Stored size: 201 Bytes

Contents

class Locking
  def self.lock_on(key, wait:, attempts:, &block)
    counter = Kredis.counter(key, expires_in: wait)
    counter.increment

    if counter.value > attempts
      yield
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
authentication-zero-2.12.6 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.12.5 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.12.4 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.12.3 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.12.2 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.12.1 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.12.0 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.11.2 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.11.1 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.11.0 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.10.0 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.9.3 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.9.2 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.9.1 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.9.0 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.8.4 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.8.3 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.8.2 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.8.1 lib/generators/authentication/templates/models/locking.rb.tt
authentication-zero-2.8.0 lib/generators/authentication/templates/models/locking.rb.tt