class Merb::MemorySession

Sessions stored in memory.

Set it up by adding the following to your init file:

Merb::Config.use do |c|
  c[:session_store]      = :memory
  c[:memory_session_ttl] = 3600 # in seconds, one hour
end

Sessions will remain in memory until the server is stopped or the time as set in :memory_session_ttl expires. Expired sessions are cleaned up in the background by a separate thread. Every time reaper cleans up expired sessions, garbage collection is scheduled start.

Memory session is accessed in a thread safe manner.

Public Class Methods

store() click to toggle source

Lazy load/setup of MemorySessionStore. :api: private

# File lib/merb-core/dispatch/session/memory.rb, line 31
def self.store
  @_store ||= MemorySessionStore.new(Merb::Config[:memory_session_ttl])
end

Public Instance Methods

store() click to toggle source

Bypass normal implicit class attribute reader - see below. :api: private

# File lib/merb-core/dispatch/session/memory.rb, line 25
def store
  self.class.store
end