Module: GRHttp::SessionManager

Defined in:
lib/grhttp/session.rb

Class Method Summary collapse

Class Method Details

.get(id) ⇒ Object

returns a session object


13
14
15
# File 'lib/grhttp/session.rb', line 13

def get id
	storage.fetch(id)
end

.storageObject


27
28
29
# File 'lib/grhttp/session.rb', line 27

def storage
	@storage ||= GRHttp::Base::SessionStorage.new
end

.storage=(session_storage) ⇒ Object

Sets the session storage object, to allow for different storage systems.

A Session Storage object must answer only one methods:

fetch(id)

returns a Hash like session object with all the session's data or a fresh session object if the session object did not exist before

The Session Object should update itself in the storage whenever data is saved to the session Object. This is important also because websocket 'session' could exist simultaneously with other HTTP requests and the data should be kept updated at all times. If there are race conditions that apply for multi-threading / multi processing, the Session Object should manage them as well as possible.


24
25
26
# File 'lib/grhttp/session.rb', line 24

def storage= session_storage
	@storage = session_storage
end