class RedisRds::String

Public Instance Methods

append(suffix) click to toggle source
# File lib/redis_rds/string.rb, line 26
def append(suffix)
  return connection.append(@redis_key, suffix)
end
decr() click to toggle source
# File lib/redis_rds/string.rb, line 46
def decr
  return connection.decr(@redis_key)
end
decrby(decrement) click to toggle source
# File lib/redis_rds/string.rb, line 50
def decrby(decrement)
  return connection.decrby(@redis_key, decrement)
end
get() click to toggle source
# File lib/redis_rds/string.rb, line 3
def get
  return connection.get(@redis_key)
end
incr() click to toggle source
# File lib/redis_rds/string.rb, line 30
def incr
  return connection.incr(@redis_key)
end
incrby(increment) click to toggle source
# File lib/redis_rds/string.rb, line 34
def incrby(increment)
  return connection.incrby(@redis_key, increment)
end
length() click to toggle source
# File lib/redis_rds/string.rb, line 38
def length
  return connection.strlen(@redis_key)
end
set(value, expiry: nil, nx: nil, xx: nil) click to toggle source

Lifted from npepine/restruct @param [Object] value The object to store; note, it will be stored using a string representation @param [Integer] expiry The expiry time in seconds; if nil, will never expire @param [Boolean] nx Not Exists: if true, will not set the key if it already existed @param [Boolean] xx Already Exists: if true, will set the key only if it already existed @return [Boolean] True if set, false otherwise

# File lib/redis_rds/string.rb, line 13
def set(value, expiry: nil, nx: nil, xx: nil)
  options = {}
  options[:ex] = expiry.to_i unless expiry.nil?
  options[:nx] = nx unless nx.nil?
  options[:xx] = xx unless xx.nil?

  connection.set(@redis_key, value, options)
end
setex(value, expiry) click to toggle source
# File lib/redis_rds/string.rb, line 22
def setex(value, expiry)
  return connection.setex(@redis_key, expiry, value)
end
setnx(value) click to toggle source
# File lib/redis_rds/string.rb, line 42
def setnx(value)
  return connection.setnx(@redis_key, value)
end