Module: Cassie::ConnectionHandler::Sessions
- Extended by:
- ActiveSupport::Concern
- Included in:
- Cassie::ConnectionHandler
- Defined in:
- lib/cassie/connection_handler/sessions.rb,
lib/cassie/connection_handler/sessions/instrumentation.rb
Defined Under Namespace
Modules: Instrumentation
Instance Attribute Summary collapse
-
#sessions ⇒ Hash{String => Cassandra::Session}
readonly
Sessions cache containint sessions that have been opened to the Cluster#cluster.
Instance Method Summary collapse
-
#session(keyspace = self.keyspace) ⇒ Cassandra::Session
Fetches a session from the sessions cache.
Instance Attribute Details
#sessions ⇒ Hash{String => Cassandra::Session} (readonly)
Sessions cache containint sessions that have been opened to the Cluster#cluster
14 15 16 |
# File 'lib/cassie/connection_handler/sessions.rb', line 14 def sessions @sessions ||= {} end |
Instance Method Details
#session(keyspace = self.keyspace) ⇒ Cassandra::Session
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#cluster and cached.
23 24 25 |
# File 'lib/cassie/connection_handler/sessions.rb', line 23 def session(keyspace=self.keyspace) sessions[keyspace] || initialize_session(keyspace) end |