Module: Pools::Pooled

Extended by:
ActiveSupport::Concern
Included in:
Cassandra::Pooled, CassandraCQL::Pooled, Redis::Pooled
Defined in:
lib/pools/pooled.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection_poolObject (readonly)

Returns the value of attribute connection_pool.



7
8
9
# File 'lib/pools/pooled.rb', line 7

def connection_pool
  @connection_pool
end

#preparation_chainObject (readonly)

Returns the value of attribute preparation_chain.



7
8
9
# File 'lib/pools/pooled.rb', line 7

def preparation_chain
  @preparation_chain
end

Instance Method Details

#__connectionObject



20
21
22
# File 'lib/pools/pooled.rb', line 20

def __connection
  # Override in parent
end

#__disconnect(connection) ⇒ Object



24
25
26
# File 'lib/pools/pooled.rb', line 24

def __disconnect(connection)
  # Override in parent
end

#__prepare(connection) ⇒ Object



28
29
30
# File 'lib/pools/pooled.rb', line 28

def __prepare(connection)
  @preparation_chain.each { |args| connection.send(*args) }
end

#initialize(*args) ⇒ Object



9
10
11
12
13
14
# File 'lib/pools/pooled.rb', line 9

def initialize(*args)
  options = args.extract_options!
  @preparation_chain = []
  @connection_pool = ConnectionPool.new(self, options)
  Pools.handler.add(@connection_pool, options[:pool_name])
end

#with_connection(&block) ⇒ Object



16
17
18
# File 'lib/pools/pooled.rb', line 16

def with_connection(&block)
  @connection_pool.with_connection(&block)
end