class GitHub::Ldap::ConnectionCache
A simple cache of GitHub::Ldap
objects to prevent creating multiple instances of connections that point to the same URI/host.
Public Class Methods
get_connection(options={})
click to toggle source
Public - Create or return cached instance of GitHub::Ldap
created with options, where the cache key is the value of options.
options - Initialization attributes suitable for creating a new connection with GitHub::Ldap.new(options)
Returns true or false.
# File lib/github/ldap/connection_cache.rb, line 15 def self.get_connection(options={}) @cache ||= self.new @cache.get_connection(options) end
Public Instance Methods
get_connection(options)
click to toggle source
# File lib/github/ldap/connection_cache.rb, line 20 def get_connection(options) @connections ||= {} @connections[options[:host]] ||= GitHub::Ldap.new(options) end