Sha256: 9435bf5a9f8c8a7f166c497868554bb361e226bcb7d9d2f7d904c575f4a62aed

Contents?: true

Size: 496 Bytes

Versions: 7

Compression:

Stored size: 496 Bytes

Contents

require 'redis'

module Momm
  class RedisStore < Storage
    DEFAULT_OPTIONS = { host: "localhost", port: 6379, namespace: "momm"}

    attr_accessor :options

    def initialize(options = {})
      @options = DEFAULT_OPTIONS.dup.merge options
    end

    def client
      @client ||= begin
        ns = options.delete(:namespace)

        require 'redis/namespace'
        native_client = Redis.new options

        Redis::Namespace.new(ns, :redis => native_client)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
momm-0.0.7 lib/momm/redis_store.rb
momm-0.0.6 lib/momm/redis_store.rb
momm-0.0.5 lib/momm/redis_store.rb
momm-0.0.4 lib/momm/redis_store.rb
momm-0.0.3 lib/momm/redis_store.rb
momm-0.0.2 lib/momm/redis_store.rb
momm-0.0.1 lib/momm/redis_store.rb