Class: CountingSemaphore::RedisSemaphore::NullPool

Inherits:
Object
  • Object
show all
Defined in:
lib/counting_semaphore/redis_semaphore.rb

Overview

Null pool for bare Redis connections that don't need connection pooling. Provides a compatible interface with ConnectionPool for bare Redis instances.

Instance Method Summary collapse

Constructor Details

#initialize(redis_connection) ⇒ NullPool

Creates a new NullPool wrapper around a Redis connection.

Parameters:

  • redis_connection (Redis) —

    The Redis connection to wrap



163
164
165
# File 'lib/counting_semaphore/redis_semaphore.rb', line 163

def initialize(redis_connection)
  @redis_connection = redis_connection
end

Instance Method Details

#with {|redis| ... } ⇒ Object

Yields the wrapped Redis connection to the block. Provides ConnectionPool-compatible interface.

Yields:

  • (redis) —

    The Redis connection

Returns:

  • The result of the block



172
173
174
# File 'lib/counting_semaphore/redis_semaphore.rb', line 172

def with(&block)
  block.call(@redis_connection)
end