Class: CassandraModel::ConnectionCache
- Inherits:
-
Object
- Object
- CassandraModel::ConnectionCache
- Defined in:
- lib/cassandra_model/connection_cache.rb
Constant Summary collapse
- MUTEX =
Mutex.new
- @@cache =
build_cache
Class Method Summary collapse
Class Method Details
.[](key) ⇒ Object
12 13 14 |
# File 'lib/cassandra_model/connection_cache.rb', line 12 def [](key) @@cache[key] end |
.build_cache ⇒ Object
6 7 8 9 10 |
# File 'lib/cassandra_model/connection_cache.rb', line 6 def build_cache Hash.new do |hash, key| MUTEX.synchronize { hash[key] = RawConnection.new(key) } end end |
.clear ⇒ Object
16 17 18 19 |
# File 'lib/cassandra_model/connection_cache.rb', line 16 def clear @@cache.values.map(&:shutdown) @@cache.clear end |