I am looking for some documentation for the ruby client for redis with no luck. I am using keys, but I've heard their performance in production redis is terrible.
$redis = Redis.new(host: Settings.redis_host, port: Settings.redis_port)
keys = $redis.keys("prefix*")
Want to switch to $redis.scan("prefix*")
but I didn't find any examples for it.
also tried
keys = $redis.scan(0, {match: "key:1?"})
Redis::CommandError: ERR syntax error
keys = $redis.scan(0, match: "key:1?")
Redis::CommandError: ERR syntax error
appreciate a little light on this. Thanks.
Edit: After updating the redis client from 3.0.4 to 3.0.7 the
keys = $redis.scan(0, match: "prefix*")
worked.
Do it like this:
keys = $redis.scan(0, match: 'prefix?')
Here is the "documentation" you need.
Be sure to also read the official documentation of SCAN
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With