Class Rack::Session::Pool
In: lib/rack/session/pool.rb
Parent: Object

Rack::Session::Pool provides simple cookie based session management. Session data is stored in a hash held by @pool. The corresponding session key sent to the client. The pool is unmonitored and unregulated, which means that over prolonged use the session pool will be very large.

Example:

    use Rack::Session::Pool, :key => 'rack.session',
                             :domain => 'foo.com',
                             :path => '/',
                             :expire_after => 2592000

    All parameters are optional.

Methods

call   context   new  

Attributes

key  [R] 
pool  [R] 

Public Class methods

[Source]

    # File lib/rack/session/pool.rb, line 23
23:       def initialize(app, options={})
24:         @app = app
25:         @key = options[:key] || "rack.session"
26:         @default_options = {:domain => nil,
27:           :path => "/",
28:           :expire_after => nil}.merge(options)
29:         @pool = Hash.new
30:         @default_context = context app, &nil
31:       end

Public Instance methods

[Source]

    # File lib/rack/session/pool.rb, line 34
34:       def call(env)
35:         @default_context.call(env)
36:       end

[Source]

    # File lib/rack/session/pool.rb, line 38
38:       def context(app, &block)
39:         Rack::Utils::Context.new self, app do |env|
40:           load_session env
41:           block[env] if block
42:           response = app.call(env)
43:           commit_session env, response
44:           response
45:         end
46:       end

[Validate]