Class: Merb::MemorySession

Inherits:
SessionStoreContainer show all
Defined in:
lib/merb-core/dispatch/session/memory.rb

Overview

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.

Constant Summary

Constants inherited from SessionStoreContainer

SessionStoreContainer::GENERATE_MAX_TRIES

Instance Attribute Summary

Attributes inherited from SessionStoreContainer

#_fingerprint

Attributes inherited from SessionContainer

#needs_new_cookie, #session_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SessionStoreContainer

#finalize, generate, #regenerate, setup

Methods inherited from SessionContainer

#clear!, #finalize, generate, inherited, #initialize, #regenerate, setup

Constructor Details

This class inherits a constructor from Merb::SessionContainer

Class Method Details

.storeObject

Lazy load/setup of MemorySessionStore. :api: private


31
32
33
# File 'lib/merb-core/dispatch/session/memory.rb', line 31

def self.store
  @_store ||= MemorySessionStore.new(Merb::Config[:memory_session_ttl])
end

Instance Method Details

#storeObject

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


25
26
27
# File 'lib/merb-core/dispatch/session/memory.rb', line 25

def store
  self.class.store
end