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.



4
5
6
# File 'lib/solid_cache/store/clusters.rb', line 4

def clusters
  @clusters
end

#primary_clusterObject (readonly)

Returns the value of attribute primary_cluster.



4
5
6
# File 'lib/solid_cache/store/clusters.rb', line 4

def primary_cluster
  @primary_cluster
end

Instance Method Details

#initialize(options = {}) ⇒ Object



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

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))
  end

  @primary_cluster = clusters.first
end

#setup!Object



18
19
20
# File 'lib/solid_cache/store/clusters.rb', line 18

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