You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 1. A redis URL (valid for `Redis.new(url: url)`)
# 2. an options hash compatible with `Redis.new`
# 3. or a valid Redis instance (one that responds to `#smembers`). Likely,
# this will be an instance of either `Redis`, `Redis::Client`,
# `Redis::DistRedis`, or `Redis::Namespace`.
defredis=(server)
@redis=ifserver.is_a?(String)
Redis.new(url: server)
elsifserver.is_a?(Hash)
Redis.new(server)
elsifserver.respond_to?(:smembers)
server
else
raiseArgumentError,
"You must supply a url, options hash or valid Redis connection instance"
end
end
# Returns the current Redis connection. If none has been created, will
# create a new one.
defredis
return@redisif@redis
self.redis=self.configuration.redis
self.redis
end
# Call this method to modify defaults in your initializers.
#
# @example
# Split.configure do |config|
# config.ignore_ip_addresses = '192.168.2.1'
# end
defconfigure
self.configuration ||= Configuration.new
yield(configuration)
end
defcache(namespace,key, &block)
Split::Cache.fetch(namespace,key, &block)
end
end
# Check to see if being run in a Rails application. If so, wait until before_initialize to run configuration so Gems that create ENV variables have the chance to initialize first.