Module: SolidCache::Store::Clusters

Included in:
SolidCache::Store
Defined in:
lib/solid_cache/store/clusters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clustersObject (readonly)

Returns the value of attribute clusters.



6
7
8
# File 'lib/solid_cache/store/clusters.rb', line 6

def clusters
  @clusters
end

#primary_clusterObject (readonly)

Returns the value of attribute primary_cluster.



6
7
8
# File 'lib/solid_cache/store/clusters.rb', line 6

def primary_cluster
  @primary_cluster
end

Instance Method Details

#initialize(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/solid_cache/store/clusters.rb', line 8

def initialize(options = {})
  super(options)

  clusters_options = options.fetch(:clusters) { [ options.fetch(:cluster, {}) ] }

  @clusters = clusters_options.map.with_index do |cluster_options, index|
    Cluster.new(options.merge(cluster_options).merge(async_writes: index != 0, error_handler: error_handler))
  end

  @primary_cluster = clusters.first
end

#setup!Object



20
21
22
# File 'lib/solid_cache/store/clusters.rb', line 20

def setup!
  clusters.each(&:setup!)
end