Class: Rack::Session::Pool

Inherits:
Abstract::ID show all
Defined in:
lib/gems/rack-0.9.1/lib/rack/session/pool.rb

Overview

Rack::Session::Pool provides simple cookie based session management. Session data is stored in a hash held by @pool. In the context of a multithreaded environment, sessions being committed to the pool is done in a merging manner.

Example:

myapp = MyRackApp.new
sessioned = Rack::Session::Pool.new(myapp,
  :key => 'rack.session',
  :domain => 'foo.com',
  :path => '/',
  :expire_after => 2592000
)
Rack::Handler::WEBrick.run sessioned

Constant Summary collapse

DEFAULT_OPTIONS =
Abstract::ID::DEFAULT_OPTIONS.dup

Instance Attribute Summary collapse

Attributes inherited from Abstract::ID

#key

Instance Method Summary collapse

Methods inherited from Abstract::ID

#call, #context

Constructor Details

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

Returns a new instance of Pool.



30
31
32
33
34
# File 'lib/gems/rack-0.9.1/lib/rack/session/pool.rb', line 30

def initialize(app, options={})
  super
  @pool = Hash.new
  @mutex = Mutex.new
end

Instance Attribute Details

#mutexObject (readonly)

Returns the value of attribute mutex.



27
28
29
# File 'lib/gems/rack-0.9.1/lib/rack/session/pool.rb', line 27

def mutex
  @mutex
end

#poolObject (readonly)

Returns the value of attribute pool.



27
28
29
# File 'lib/gems/rack-0.9.1/lib/rack/session/pool.rb', line 27

def pool
  @pool
end