module Shamu::Sessions::SessionStore
Exposes a persistent key/value store to track state across multiple requests.
Public Class Methods
create( scorpion, *args, &block )
click to toggle source
# File lib/shamu/sessions/session_store.rb, line 8 def self.create( scorpion, *args, &block ) return scorpion.fetch Shamu::Sessions::CookieStore, *args, &block if defined? Rack fail "Configure a Shamu::Sessions::SessionStore in your scorpion setup." end
Public Instance Methods
delete( key )
click to toggle source
Remove the value with the given key. @param [String] key @return [nil]
# File lib/shamu/sessions/session_store.rb, line 36 def delete( key ) fail NotImplementedError end
fetch( key, &block )
click to toggle source
Fetch the value with the given key from the store. If they key does not yet exist, yields to the block and caches the result.
@param [String] key @yieldreturn The calculated value of the key. @return [Object]
# File lib/shamu/sessions/session_store.rb, line 20 def fetch( key, &block ) fail NotImplementedError end
set( key, value )
click to toggle source
Save a named value in the session.
@param [String] key @param [Object] value. Must be a primitive (String, Number, Hash, Array). @return [value]
# File lib/shamu/sessions/session_store.rb, line 29 def set( key, value ) fail NotImplementedError end