Class: ApnsDispatch::ApnsConnectionPool

Inherits:
Object
  • Object
show all
Defined in:
lib/apns_dispatch/apns_connection_pool.rb

Overview

Caches and returns individual unique ApnsConnections in memory.

Class Method Summary collapse

Class Method Details

.connection(certificate, options = {}) ⇒ Object


8
9
10
11
12
13
14
15
16
17
# File 'lib/apns_dispatch/apns_connection_pool.rb', line 8

def self.connection(certificate, options={})
  if certificate
    cache_key = cache_key(certificate, options)

    @connections ||= {}
    @connections[cache_key] ||= ApnsDispatch::ApnsConnection.new(certificate, options)
  else
    ApnsDispatch::NullApnsConnection.new
  end
end