class Redis
Public Instance Methods
json_arr_append(key, value, p: nil)
click to toggle source
array
# File lib/redis_rejson.rb, line 58 def json_arr_append(key, value, p: nil) jto_i client.call json_cmd_two(:arrappend, key, value, p) end
json_arr_index(key, value, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 62 def json_arr_index(key, value, p: nil) jto_i client.call json_cmd_two(:arrindex, key, value, p) end
json_arr_insert(key, value, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 66 def json_arr_insert(key, value, p: nil) jto_i client.call json_cmd_two(:arrinsert, key, value, p) end
json_arr_len(key, value, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 70 def json_arr_len(key, value, p: nil) jto_i client.call json_cmd_two(:arrlen, key, value, p) end
json_get(key, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 15 def json_get(key, p: nil) client.call json_cmd_one(:get, key, p) end
json_mget(key, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 23 def json_mget(key, p: nil) end
json_num_incr(key, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 43 def json_num_incr(key, p: nil) jto_i client.call json_cmd_two(:numincrby, key, 1, p) end
json_num_incr_by(key, value, p: nil)
click to toggle source
num
# File lib/redis_rejson.rb, line 39 def json_num_incr_by(key, value, p: nil) jto_i client.call json_cmd_two(:numincrby, key, value, p) end
json_num_mult_by(key, value, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 47 def json_num_mult_by(key, value, p: nil) jto_i client.call json_cmd_two(:nummultby, key, value, p) end
json_num_mult_double(key, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 51 def json_num_mult_double(key, p: nil) jto_i client.call json_cmd_two(:nummultby, key, 2, p) end
json_set(key, value, p: nil)
click to toggle source
key
# File lib/redis_rejson.rb, line 11 def json_set(key, value, p: nil) client.call json_cmd_two(:set, key, value, p) end
json_str_append(key, value, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 33 def json_str_append(key, value, p: nil) client.call json_cmd_two(:strappend, key, value, p) end
json_str_len(key, p: nil)
click to toggle source
string
# File lib/redis_rejson.rb, line 29 def json_str_len(key, p: nil) client.call json_cmd_one(:strlen, key, p) end
json_type(key, p: nil)
click to toggle source
# File lib/redis_rejson.rb, line 19 def json_type(key, p: nil) client.call json_cmd_one(:type, key, p) end
Private Instance Methods
json_cmd_one(cmd, key, path)
click to toggle source
json command, one parameter
# File lib/redis_rejson.rb, line 85 def json_cmd_one(cmd, key, path) unless path ["JSON.#{cmd.upcase}", key] else ["JSON.#{cmd.upcase}", key, path] end end
json_cmd_two(cmd, key, value, path)
click to toggle source
json command, two parameters
# File lib/redis_rejson.rb, line 94 def json_cmd_two(cmd, key, value, path) unless path ["JSON.#{cmd.upcase}", key, ".", value] else ["JSON.#{cmd.upcase}", key, path, value] end end
jto_i(value)
click to toggle source
util
# File lib/redis_rejson.rb, line 80 def jto_i(value) value.to_i end