A web application session.

State is a neccessary evil but session variables should be avoided as much as possible. Session state is typically distributed to many servers so avoid storing complete objects in session variables, only store oids and small integer/strings.

The session should be persistable to survive server shutdowns.

The session can be considered as a Hash where key-value pairs are stored. Typically symbols are used as keys. By convention uppercase symbols are used for internal system session parameters (ie :FLASH, :USER, etc). User applications typically use lowercase symbols (ie :cart, :history, etc).

Methods
Public Class methods
new(hash = nil)

Create the session for the given context. If the hook method ‘created’ is defined it is called at the end. Typically used to initialize the session hash.

    # File lib/raw/context/session.rb, line 45
45:   def initialize(hash = nil)
46:     super()
47:     update(hash) if hash
48:     expires_after(Session.keepalive)
49:     created()
50:   end
Public Instance methods
[](key)
    # File lib/raw/context/session.rb, line 58
58:   def [](key)
59:     super(key.to_s)
60:   end
[]=(key, val)
    # File lib/raw/context/session.rb, line 62
62:   def []=(key, val)
63:     super(key.to_s, val)
64:   end
created()

Override this callback if you need to initialize some session data.

    # File lib/raw/context/session.rb, line 55
55:   def created
56:   end
delete(key)
    # File lib/raw/context/session.rb, line 66
66:   def delete(key)
67:     super(key.to_s)
68:   end