Module: RedisCopy::KeyEmitter
- Extended by:
- Implements::Interface
- Defined in:
- lib/redis-copy/key-emitter.rb
Overview
A Key emitter emits keys. This is built to be an abstraction on top of redis.keys(‘*’) (implemented by RedisCopy::KeyEmitter::Default), but should allow smarter implementations to be built that can handle billion-key dbs without blocking on IO.
Defined Under Namespace
Instance Method Summary collapse
- #dbsize ⇒ Object
- #initialize(redis, ui, options = {}) ⇒ Object
- #keys ⇒ Enumerable<String>
- #pattern ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#dbsize ⇒ Object
31 32 33 |
# File 'lib/redis-copy/key-emitter.rb', line 31 def dbsize @redis.dbsize end |
#initialize(redis, ui, options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/redis-copy/key-emitter.rb', line 15 def initialize(redis, ui, = {}) @redis = redis @ui = ui @options = end |
#keys ⇒ Enumerable<String>
22 23 24 25 |
# File 'lib/redis-copy/key-emitter.rb', line 22 def keys return super if defined?(super) raise NotImplementedError end |
#pattern ⇒ Object
27 28 29 |
# File 'lib/redis-copy/key-emitter.rb', line 27 def pattern @pattern ||= @options.fetch(:pattern) { '*' } end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/redis-copy/key-emitter.rb', line 35 def to_s self.class.name.demodulize end |