Sha256: c756d424e80e6d0278b77d4c9ab0c255d3562ec2174c9ad2bac4141af8bfc293

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

module Shamu
  module Sessions

    # Exposes a persistent key/value store to track state across multiple
    # requests.
    module SessionStore

      def self.create( scorpion, *args, **dependencies, &block )
        return scorpion.fetch Shamu::Sessions::CookieStore, *args, **dependencies, &block if defined? Rack

        fail "Configure a Shamu::Sessions::SessionStore in your scorpion setup."
      end

      # 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]
      def fetch( key, &block )
        fail NotImplementedError
      end

      # Save a named value in the session.
      #
      # @param [String] key
      # @param [Object] value. Must be a primitive (String, Number, Hash, Array).
      # @return [value]
      def set( key, value )
        fail NotImplementedError
      end

      # Remove the value with the given key.
      # @param [String] key
      # @return [nil]
      def delete( key )
        fail NotImplementedError
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
shamu-0.0.21 lib/shamu/sessions/session_store.rb
shamu-0.0.20 lib/shamu/sessions/session_store.rb
shamu-0.0.19 lib/shamu/sessions/session_store.rb
shamu-0.0.18 lib/shamu/sessions/session_store.rb
shamu-0.0.17 lib/shamu/sessions/session_store.rb
shamu-0.0.15 lib/shamu/sessions/session_store.rb
shamu-0.0.14 lib/shamu/sessions/session_store.rb
shamu-0.0.13 lib/shamu/sessions/session_store.rb
shamu-0.0.11 lib/shamu/sessions/session_store.rb
shamu-0.0.9 lib/shamu/sessions/session_store.rb
shamu-0.0.8 lib/shamu/sessions/session_store.rb
shamu-0.0.7 lib/shamu/sessions/session_store.rb
shamu-0.0.5 lib/shamu/sessions/session_store.rb
shamu-0.0.4 lib/shamu/sessions/session_store.rb
shamu-0.0.3 lib/shamu/sessions/session_store.rb
shamu-0.0.2 lib/shamu/sessions/session_store.rb