| Class | CGI::Session::MemoryStore |
| In: |
lib/cgi/session.rb
|
| Parent: | Object |
In-memory session storage class.
Implements session storage as a global in-memory hash. Session data will only persist for as long as the ruby interpreter instance does.
Create a new MemoryStore instance.
session is the session this instance is associated with. option is a list of initialisation options. None are currently recognised.
# File lib/cgi/session.rb, line 451
451: def initialize(session, option=nil)
452: @session_id = session.session_id
453: unless GLOBAL_HASH_TABLE.key?(@session_id)
454: unless session.new_session
455: raise CGI::Session::NoSession, "uninitialized session"
456: end
457: GLOBAL_HASH_TABLE[@session_id] = {}
458: end
459: end
Close session storage.
A no-op.
# File lib/cgi/session.rb, line 478
478: def close
479: # don't need to close
480: end
Delete the session state.
# File lib/cgi/session.rb, line 483
483: def delete
484: GLOBAL_HASH_TABLE.delete(@session_id)
485: end