Class: OpenC3::StoreConnectionPool

Inherits:
ConnectionPool
  • Object
show all
Defined in:
lib/openc3/utilities/store_autoload.rb

Constant Summary collapse

NO_OPTIONS =
{}

Instance Method Summary collapse

Instance Method Details

#pipelinedObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/openc3/utilities/store_autoload.rb', line 39

def pipelined
  with(NO_OPTIONS) do |redis|
    redis.pipelined do |pipeline|
      Thread.current[:pipeline] = pipeline
      begin
        yield
      ensure
        Thread.current[:pipeline] = nil
      end
    end
  end
end

#with(options = NO_OPTIONS, &block) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/openc3/utilities/store_autoload.rb', line 52

def with(options = NO_OPTIONS, &block)
  pipeline = Thread.current[:pipeline]
  if pipeline
    yield pipeline
  else
    super(options, &block)
  end
end