Sha256: e770aef1d2ec310683070da1c8c859703e8ce3abd699303c53089843a3ad742d

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

require 'redis'

module Riedi
  class Storage
    def initialize(options = {})
      @options = options
    end

    def flushall
      redis.flushall
    end

    def status
      begin
        redis.randomkey
        "OK"
      rescue
        "NG"
      end
    end

    def keys
      redis.keys
    end

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

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

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

private

    def redis
      @redis ||= Redis.new(@options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riedi-0.0.1 lib/riedi/storage.rb