lib/object/cache.rb in object-cache-0.0.4 vs lib/object/cache.rb in object-cache-0.0.5
- old
+ new
@@ -87,10 +87,11 @@
def primary
backend.is_a?(Hash) ? backend[:primary] : backend
end
def replicas
- [backend.is_a?(Hash) ? backend[:replicas] : backend].flatten
+ replicas = backend.is_a?(Hash) ? backend[:replicas] : backend
+ replicas.respond_to?(:sample) ? replicas : [replicas]
end
def replica
replicas.sample
end