# File lib/sshkit/backends/connection_pool/cache.rb, line 36 def evict # Peek at the first connection to see if it is still fresh. If so, we can # return right away without needing to use `synchronize`. first_expires_at, _connection = connections.first return if first_expires_at.nil? || fresh?(first_expires_at) connections.synchronize do fresh, stale = connections.partition do |expires_at, _| fresh?(expires_at) end connections.replace(fresh) stale.each { |_, conn| closer.call(conn) } end end