Sha256: 204f973552f901f50651010508d40a2ce868d7e48b93baae2cbda08ffd30f4eb

Contents?: true

Size: 599 Bytes

Versions: 3

Compression:

Stored size: 599 Bytes

Contents

require 'set'
require 'redis'

module Flipper
  module Adapters
    class Redis
      def initialize(client)
        @client = client
      end

      def read(key)
        @client.get key
      end

      def write(key, value)
        @client.set key, value
      end

      def delete(key)
        @client.del key
      end

      def set_add(key, value)
        @client.sadd(key, value)
      end

      def set_delete(key, value)
        @client.srem(key, value)
      end

      def set_members(key)
        @client.smembers(key).map { |member| member.to_i }.to_set
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flipper-redis-0.2.0 lib/flipper/adapters/redis.rb
flipper-redis-0.1.1 lib/flipper/adapters/redis.rb
flipper-redis-0.1.0 lib/flipper/adapters/redis.rb