class SidekiqUniqueJobs::LockInfo

Class Info provides information about a lock

@author Mikael Henriksson <mikael@mhenrixon.com>

Public Instance Methods

[](key) click to toggle source

Quick access to the hash members for the value

@param [String, Symbol] key the key who's value to retrieve

@return [Object]

# File lib/sidekiq_unique_jobs/lock_info.rb, line 47
def [](key)
  value[key.to_s] if value.is_a?(Hash)
end
none?() click to toggle source

Check if this redis string is blank

@return [Boolean]

# File lib/sidekiq_unique_jobs/lock_info.rb, line 26
def none?
  value.nil? || value.empty?
end
present?() click to toggle source

Check if this redis string has a value

@return [Boolean]

# File lib/sidekiq_unique_jobs/lock_info.rb, line 36
def present?
  !none?
end
set(obj) click to toggle source

Writes the lock info to redis

@param [Hash] obj the information to store at key

@return [Hash]

Calls superclass method
# File lib/sidekiq_unique_jobs/lock_info.rb, line 58
def set(obj)
  return unless SidekiqUniqueJobs.config.lock_info
  raise InvalidArgument, "argument `obj` (#{obj}) needs to be a hash" unless obj.is_a?(Hash)

  json = dump_json(obj)
  @value = load_json(json)
  super(json)
  value
end
value() click to toggle source

Returns the value for this key as a hash

@return [Hash]

Calls superclass method
# File lib/sidekiq_unique_jobs/lock_info.rb, line 16
def value
  @value ||= load_json(super)
end