| 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 457
457: def initialize(session, option=nil)
458: @session_id = session.session_id
459: unless GLOBAL_HASH_TABLE.key?(@session_id)
460: unless session.new_session
461: raise CGI::Session::NoSession, "uninitialized session"
462: end
463: GLOBAL_HASH_TABLE[@session_id] = {}
464: end
465: end
Close session storage.
A no-op.
# File lib/cgi/session.rb, line 484
484: def close
485: # don't need to close
486: end
Delete the session state.
# File lib/cgi/session.rb, line 489
489: def delete
490: GLOBAL_HASH_TABLE.delete(@session_id)
491: end