Module: Documentrix::Documents::Cache::Records::RedisFullEach

Defined in:
lib/documentrix/documents/cache/records.rb

Instance Method Summary collapse

Instance Method Details

#full_each {|key, value| ... } ⇒ Object

The full_each method iterates over all records in the cache and yields them to the block.

Yields:

  • (key, value)

    where key is the record's key and value is the record itself



50
51
52
53
54
55
56
# File 'lib/documentrix/documents/cache/records.rb', line 50

def full_each(&block)
  redis.scan_each(match: [ Documentrix::Documents, ?* ] * ?-) do |key|
    value = redis.get(key) or next
    value = JSON(value, object_class: Documentrix::Documents::Record)
    block.(key, value)
  end
end