Sha256: 636e245afbbb4dec30084595035269d185898b51b0a08f7f3c0cfba63a3b20e3

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

module FFlags
  # Redis Client
  class RedisClient
    # hset doesn't return explicitly true or false
    def set(key, field, value)
      return false if value.nil?

      client.hset(key, field, value.to_s)
    end

    def all(key)
      client.hgetall(key)
    end

    def get(key, field)
      client.hget(key, field)
    end

    def reset(key)
      client.del(key)
    end

    private

    def client
      if FFlags.configuration.redis_url
        # Legacy support
        @client ||= Redis.new(url: FFlags.configuration.redis_url)
      else
        @client ||= Redis.new(FFlags.configuration.redis_options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fflags-0.6.0 lib/fflags/redis_client.rb