soveran / rediscan

Scanner for Redis keyspace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rediscan

Scanner for Redis keyspace

Description

Rediscan lets you iterate over the Redis keyspace and execute a block for each match.

Usage

You need to supply a Redis client. There are no restrictions regarding the type of the Redis client, but it must respond to call and the signature must be identical to that of Redic.

r = Rediscan.new(Redic.new)

Once you have the Rediscan instance, you can use it as follows:

r.each do |key|
  # Do something with `key`
end

You can also provide match and count arguments:

r.each(match: "ost:*", count: 4) do |key|
  # Do something with `key`
end

For the meaning for match and count, check the documentation of the SCAN command.

Installation

You can install it using rubygems.

$ gem install rediscan

About

Scanner for Redis keyspace

License:MIT License


Languages

Language:Ruby 100.0%