Module: RedisCluster::Function::Scan
- Included in:
- RedisCluster::Function
- Defined in:
- lib/redis_cluster/function/scan.rb
Overview
Scan is a collection of redis scan functions
Constant Summary collapse
- HSCAN =
->(v){ [v[0], v[1].each_slice(2).to_a] }
- ZSCAN =
->(v){ [v[0], Redis::FloatifyPairs.call(v[1])] }
Instance Method Summary collapse
-
#hscan(key, cursor, options = {}) ⇒ String, Array<[String, String]>
Scan a hash.
-
#sscan(key, cursor, options = {}) ⇒ String+
Scan a set.
-
#zscan(key, cursor, options = {}) ⇒ String, Array<[String, Float]>
Scan a sorted set.
Instance Method Details
#hscan(key, cursor, options = {}) ⇒ String, Array<[String, String]>
Scan a hash
44 45 46 47 48 49 50 |
# File 'lib/redis_cluster/function/scan.rb', line 44 def hscan(key, cursor, = {}) args = [:hscan, key, cursor] args.push('MATCH', [:match]) if [:match] args.push('COUNT', [:count]) if [:count] call(key, args, transform: HSCAN, read: true) end |
#sscan(key, cursor, options = {}) ⇒ String+
Scan a set
63 64 65 66 67 68 69 |
# File 'lib/redis_cluster/function/scan.rb', line 63 def sscan(key, cursor, = {}) args = [:sscan, key, cursor] args.push('MATCH', [:match]) if [:match] args.push('COUNT', [:count]) if [:count] call(key, args, read: true) end |
#zscan(key, cursor, options = {}) ⇒ String, Array<[String, Float]>
Scan a sorted set
25 26 27 28 29 30 31 |
# File 'lib/redis_cluster/function/scan.rb', line 25 def zscan(key, cursor, = {}) args = [:zscan, key, cursor] args.push('MATCH', [:match]) if [:match] args.push('COUNT', [:count]) if [:count] call(key, args, transform: ZSCAN, read: true) end |