module Protocol::Redis::Methods::Hashes
Public Instance Methods
Delete one or more hash fields. O(N) where N is the number of fields to be removed. @see redis.io/commands/hdel @param key [Key] @param field [String]
# File lib/protocol/redis/methods/hashes.rb, line 77 def hdel(key, *fields) call('HDEL', key, *fields) end
Determine if a hash field exists. O(1). @see redis.io/commands/hexists @param key [Key] @param field [String]
# File lib/protocol/redis/methods/hashes.rb, line 85 def hexists(key, field) call('HEXISTS', key, field) end
Get the value of a hash field. O(1). @see redis.io/commands/hget @param key [Key] @param field [String]
# File lib/protocol/redis/methods/hashes.rb, line 61 def hget(key, field) call('HGET', key, field) end
Get all the fields and values in a hash. O(N) where N is the size of the hash. @see redis.io/commands/hgetall @param key [Key]
# File lib/protocol/redis/methods/hashes.rb, line 124 def hgetall(key) call('HGETALL', key) end
Increment the integer value of a hash field by the given number. O(1). @see redis.io/commands/hincrby @param key [Key] @param field [String] @param increment [Integer]
# File lib/protocol/redis/methods/hashes.rb, line 94 def hincrby(key, field, increment) call('HINCRBY', key, field, increment) end
Increment the float value of a hash field by the given amount. O(1). @see redis.io/commands/hincrbyfloat @param key [Key] @param field [String] @param increment [Double]
# File lib/protocol/redis/methods/hashes.rb, line 103 def hincrbyfloat(key, field, increment) call('HINCRBYFLOAT', key, field, increment) end
Get all the fields in a hash. O(N) where N is the size of the hash. @see redis.io/commands/hkeys @param key [Key]
# File lib/protocol/redis/methods/hashes.rb, line 110 def hkeys(key) call('HKEYS', key) end
Get the number of fields in a hash. O(1). @see redis.io/commands/hlen @param key [Key]
# File lib/protocol/redis/methods/hashes.rb, line 30 def hlen(key) call('HLEN', key) end
Get the values of all the given hash fields. O(N) where N is the number of fields being requested. @see redis.io/commands/hmget @param key [Key] @param field [String]
# File lib/protocol/redis/methods/hashes.rb, line 69 def hmget(key, *fields, &blk) call('HMGET', key, *fields, &blk) end
Set multiple hash fields to multiple values. O(N) where N is the number of fields being set. @see redis.io/commands/hmset @param key [Key]
# File lib/protocol/redis/methods/hashes.rb, line 53 def hmset(key, *attrs) call('HMSET', key, *attrs) end
Set the string value of a hash field. O(1) for each field/value pair added, so O(N) to add N field/value pairs when the command is called with multiple field/value pairs. @see redis.io/commands/hset @param key [Key]
# File lib/protocol/redis/methods/hashes.rb, line 37 def hset(key, field, value) call('HSET', key, field, value) end
Set the value of a hash field, only if the field does not exist. O(1). @see redis.io/commands/hsetnx @param key [Key] @param field [String] @param value [String]
# File lib/protocol/redis/methods/hashes.rb, line 46 def hsetnx(key, field, value) call('HSETNX', key, field, value) end
Get all the values in a hash. O(N) where N is the size of the hash. @see redis.io/commands/hvals @param key [Key]
# File lib/protocol/redis/methods/hashes.rb, line 117 def hvals(key) call('HVALS', key) end