Method: CFRuntime::RedisClient.create

Defined in:
lib/cf-runtime/redis.rb

.create(options = {}) ⇒ Object

Creates and returns a Redis instance connected to a single redis service. Passes optional Hash of non-connection-related options to Redis.new. Raises ArgumentError If zero or multiple redis services are found.



9
10
11
12
13
14
15
16
17
# File 'lib/cf-runtime/redis.rb', line 9

def self.create(options={})
  service_names = CloudApp.service_names_of_type('redis')
  if service_names.length != 1
    raise ArgumentError.new("Expected 1 service of redis type, " +
      "but found #{service_names.length}.  " +
      "Consider using create_from_svc(service_name) instead.")
  end
  create_from_svc(service_names[0],options)
end