Skip to content

Instantly share code, notes, and snippets.

View rpond-pa's full-sized avatar

Randy Pond rpond-pa

View GitHub Profile
#!/usr/bin/env ruby
require 'redis'
# Clear a large number of keys matching a pattern using SCAN and
# pipelining to avoid killing the server.
class ClearKeys
def initialize(pattern, host='localhost', postprocess_pattern=nil)
@redis = Redis.new(host: host)
@pattern = pattern
#!/usr/bin/env ruby
require 'redis'
# Clear a large number of keys matching a pattern using SCAN and
# pipelining to avoid killing the server.
class ClearKeys
def initialize(pattern, host='localhost', postprocess_pattern=nil)
@redis = Redis.new(host: host)
@pattern = pattern