Method: Rack::Session::Memcache#initialize

Defined in:
lib/rack/session/memcache.rb

#initialize(app, options = {}) ⇒ Memcache

Returns a new instance of Memcache.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rack/session/memcache.rb', line 29

def initialize(app, options={})
  super

  @mutex = Mutex.new
  mserv = @default_options[:memcache_server]
  mopts = @default_options.reject{|k,v| !MemCache::DEFAULT_OPTIONS.include? k }

  @pool = options[:cache] || MemCache.new(mserv, mopts)
  unless @pool.active? and @pool.servers.any?{|c| c.alive? }
    raise 'No memcache servers'
  end
end