Sha256: d9cd0be58f367254976a064b97d94b18e5911d7b6cd455b1d1bec42f161aa563
Contents?: true
Size: 718 Bytes
Versions: 1
Compression:
Stored size: 718 Bytes
Contents
require 'unique_job/logging' module UniqueJob class JobHistory include Logging def initialize(middleware_name, redis) @key_prefix = "#{self.class}:#{middleware_name.split('::')[-1]}" @redis = redis end def exists?(v1, v2) @redis.exists?(key(v1, v2)) rescue => e logger.warn { "[UniqueJob] Redis#exists? failed v1=#{v1} v2=#{v2} exception=#{e.inspect}" } nil end def add(v1, v2, ttl) @redis.setex(key(v1, v2), ttl, true) rescue => e logger.warn { "[UniqueJob] Redis#setex failed v1=#{v1} v2=#{v2} ttl=#{ttl} exception=#{e.inspect}" } nil end private def key(v1, v2) "#{@key_prefix}:#{v1}:#{v2}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unique_job-0.5.0 | lib/unique_job/job_history.rb |