Method: Stats#initialize

Defined in:
lib/stats.rb

#initialize(options) ⇒ Stats

Sets up redis usage for statistics



8
9
10
11
12
13
14
15
16
17
# File 'lib/stats.rb', line 8

def initialize(options)
  options[:redis_options] = {} unless options.has_key? :redis_options
  if options[:redis]
    @full_redis = options[:redis]
  else
    @full_redis = Redis.new(options[:redis_options])
  end
  @lock = Mutex.new
  @redis = Redis::Namespace.new("cobweb-#{Cobweb.version}-#{options[:crawl_id]}", :redis => @full_redis)
end