Sha256: 7ca0919e78fbedb17f73e3d41a0bb6ad343fd4d116f81c4b634f08b9a19f7df9

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

module SimpleWorker
  module RedisSupport

    attr_reader :namespace, :jobid

    private

    def tasks_key
      @tasks_key ||= "#{namespace}:tasks:#{jobid}"
    end

    def log_key
      @log_key ||= "#{namespace}:log:#{jobid}"
    end

    def active_tasks_key
      @active_tasks_key ||= "#{namespace}:active:#{jobid}"
    end

    def config_key
      @config_key ||= "#{namespace}:config:#{jobid}"
    end

    def load_lua_scripts
      path_to_lua_scripts = File.expand_path("scripts/", File.dirname(__FILE__))
      ['lpopall', 'expired_tasks', 'reliable_queue'].each do |name|
        sha = @redis.script(:load, IO.read("#{path_to_lua_scripts}/#{name}.lua"))
        instance_variable_set("@#{name}_sha", sha)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simpleworker-0.1.1 lib/simpleworker/redis_support.rb
simpleworker-0.1.0 lib/simpleworker/redis_support.rb