Class Merb::MemorySession
In: lib/merb-core/dispatch/session/memory.rb
Parent: Object

Sessions stored in memory.

And a setting in +merb.yml+:

  :session_store: memory
  :memory_session_ttl: 3600 (in seconds, one hour)

Sessions will remain in memory until the server is stopped or the time as set in :memory_session_ttl expires.

Methods

[]   []=   delete   each   generate   loaded?   new   persist   refresh_expiration   regenerate  

Attributes

data  [RW] 
needs_new_cookie  [RW] 
session_id  [RW] 

Public Class methods

Generates a new session ID and creates a new session.

Returns

MemorySession:The new session.

Parameters

session_id<String>:A unique identifier for this session.

Parameters

session_id<String:The ID of the session to retrieve.

Returns

Array:A pair consisting of a MemorySession and the session‘s ID. If no sessions matched session_id, a new MemorySession will be generated.

Public Instance methods

Parameters

k<~to_s>:The key of the session parameter to retrieve.

Returns

String:The value of the session parameter.

Parameters

k<~to_s>:The key of the session parameter to set.
v<~to_s>:The value of the session parameter to set.

Deletes the session by emptying stored data.

Yields the session data to an each block.

Parameter

&b:The block to pass to each.

Returns

Boolean:True if session has been loaded already.

Recreates the cookie with the default expiration time. Useful during log in for pushing back the expiration date.

Regenerate the Session ID

[Validate]