Sha256: 874988d1352e121633bc371dd265ef358e744aa061e0bebc83d75b1c7b740b5b

Contents?: true

Size: 834 Bytes

Versions: 21

Compression:

Stored size: 834 Bytes

Contents

# encoding: utf-8
module RedisHelpers
  def remotellen(lists)
    @remote_redis = Redis.new(
      :host => $redis.hget('config', 'remoteredis:host'),
      :port => $redis.hget('config', 'remoteredis:port'),
      :password => nil || $redis.hget('config', 'remoteredis:password')
    )
    result = Hash.new
    lists.each do |list|
      result.merge!(list => @remote_redis.llen(list))
    end
    return result
  end

  def remotelpush(list, value)
    @remote_redis = Redis.new(
      :host => $redis.hget('config', 'remoteredis:host'),
      :port => 6379 || $redis.hget('config', 'remoteredis:port'),
      :password => nil || $redis.hget('config', 'remoteredis:password')
    )
    begin
      @remote_redis.lpush(list, value)
      return { success => "true" }
    rescue
      return { success => "false" }
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
gaptool-server-0.4.13 lib/helpers/redis.rb
gaptool-server-0.4.12 lib/helpers/redis.rb
gaptool-server-0.4.11 lib/helpers/redis.rb
gaptool-server-0.4.10 lib/helpers/redis.rb
gaptool-server-0.4.9 lib/helpers/redis.rb
gaptool-server-0.4.8 lib/helpers/redis.rb
gaptool-server-0.4.7 lib/helpers/redis.rb
gaptool-server-0.4.6 lib/helpers/redis.rb
gaptool-server-0.4.5 lib/helpers/redis.rb
gaptool-server-0.4.4 lib/helpers/redis.rb
gaptool-server-0.4.3 lib/helpers/redis.rb
gaptool-server-0.4.2 lib/helpers/redis.rb
gaptool-server-0.4.1 lib/helpers/redis.rb
gaptool-server-0.4.0 lib/helpers/redis.rb
gaptool-server-0.3.8 lib/helpers/redis.rb
gaptool-server-0.3.7 lib/helpers/redis.rb
gaptool-server-0.3.6 lib/helpers/redis.rb
gaptool-server-0.3.3 lib/helpers/redis.rb
gaptool-server-0.3.2 lib/helpers/redis.rb
gaptool-server-0.3.1 lib/helpers/redis.rb