Sha256: 5990cea9699581cd623de166a26aead5da9bc0762b4c2122b55a45be8970cbcf

Contents?: true

Size: 498 Bytes

Versions: 7

Compression:

Stored size: 498 Bytes

Contents

require "redis"

require "socrates/storage/storage"

module Socrates
  module Storage
    class Redis
      include Socrates::Storage::Storage

      def initialize(url: "redis://localhost")
        @redis = ::Redis.new(url: url)
      end

      def has_key?(key)
        @redis.exists(key)
      end

      def clear(key)
        @redis.del(key)
      end

      def get(key)
        @redis.get(key)
      end

      def put(key, value)
        @redis.set(key, value)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
socrates-0.1.25 lib/socrates/storage/redis.rb
socrates-0.1.24 lib/socrates/storage/redis.rb
socrates-0.1.23 lib/socrates/storage/redis.rb
socrates-0.1.22 lib/socrates/storage/redis.rb
socrates-0.1.21 lib/socrates/storage/redis.rb
socrates-0.1.20 lib/socrates/storage/redis.rb
socrates-0.1.19 lib/socrates/storage/redis.rb