module Cassie::ConnectionHandler::Sessions

Public Instance Methods

session(keyspace=self.keyspace) click to toggle source

Fetches a session from the sessions cache. If no session has been opened to the requested keyspace a new session is created to the {#cluster} and cached. @param [String] keyspace The keyspace used for session scope. If nil, session will not be scoped (scoped to global space). @return [Cassandra::Session]

# File lib/cassie/connection_handler/sessions.rb, line 23
def session(keyspace=self.keyspace)
  sessions[keyspace] || initialize_session(keyspace)
end
sessions() click to toggle source

Sessions cache containint sessions that have been opened to the {#cluster} @return [Hash{String => Cassandra::Session}] The underlying driver sessions, keyed by keyspaced name @!parse attr_reader :sessions

# File lib/cassie/connection_handler/sessions.rb, line 14
def sessions
  @sessions ||= {}
end

Protected Instance Methods

initialize_session(keyspace) click to toggle source
# File lib/cassie/connection_handler/sessions.rb, line 29
def initialize_session(keyspace)
  @sessions[keyspace] = cluster.connect(keyspace)
end