Sha256: 60e5e2e89a261645f3d84300a638c320f96b40522dacfa82a6d25b08f8474712

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

class NetSystem::RedisClient < NetSystem::Client

  # https://redis.io/
  # https://github.com/redis/redis-rb
  def initialize *args
    args = [url: NetBox[:client].get(:redis_url)] if args.empty?
    log "Connecting to #{args}"
    @conn = Redis.new *args
  end

  attr_reader :conn

  def call cmd_name, *args
    t = Time.now
    result = @conn.send cmd_name, *args

    result
  ensure
    log "#{t.diff}s | #{cmd_name} | #{args}"
  end

  def now
    call :time
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lizarb-1.0.3 lib/net_system/net/controllers/client/redis_client.rb