8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/solid_cache/store/connections.rb', line 8
def initialize(options = {})
super(options)
if options[:clusters].present?
if options[:clusters].size > 1
raise ArgumentError, "Multiple clusters are no longer supported"
else
ActiveSupport.deprecator.warn(":clusters is deprecated, use :shards instead.")
end
@shard_options = options.fetch(:clusters).first[:shards]
elsif options[:cluster].present?
ActiveSupport.deprecator.warn(":cluster is deprecated, use :shards instead.")
@shard_options = options.fetch(:cluster, {})[:shards]
else
@shard_options = options.fetch(:shards, nil)
end
if [ Array, NilClass ].none? { |klass| @shard_options.is_a? klass }
raise ArgumentError, "`shards` is a `#{@shard_options.class.name}`, it should be Array or nil"
end
end
|