Module: Kredis::Query::Search
- Included in:
- Kredis
- Defined in:
- lib/kredis/query/search.rb
Instance Method Summary collapse
Instance Method Details
#search(key_pattern, batch_size: 1000, config: :shared) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/kredis/query/search.rb', line 6 def search(key_pattern, batch_size: 1000, config: :shared) pattern = namespace ? "#{namespace}:#{key_pattern}" : key_pattern cursor = "0" loop do cursor, keys = redis(config: config).scan(cursor, match: pattern, count: batch_size) redis.multi { |pipeline| yield keys, pipeline } break if cursor == "0" end end |