class Sidekiq::Pool

Defined in:

sidekiq/pool.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(size : Int32) #

Set up a pool of connections to Redis on localhost:6379:

Sidekiq::Pool.new(5)

[View source]
def self.new(cfg : RedisConfig) #

[View source]

Instance Method Detail

def redis(&) #

Execute one or more Redis operations:

pool.redis do |conn|
  conn.set("mike", "rules") => "OK"
  conn.get("mike") => "rules"
end

Or as a transaction:

pool.redis do |conn|
  conn.multi do |multi|
    multi.set("mike", "rules")
    multi.get("mike")
  end => ["OK", "mike"]
end

[View source]