Sha256: e0ebd7250a8a6ea33d3b0a33a3033757d9820dd05a371782b513f830d66ab6dc

Contents?: true

Size: 353 Bytes

Versions: 4

Compression:

Stored size: 353 Bytes

Contents

# frozen_string_literal: true

module AsyncStorage
  module_function

  def flush_all
    keys.inject(0) do |total, (key, cli)|
      total + cli.del(key)
    end
  end

  def keys
    Enumerator.new do |yielder|
      redis_pool.with do |cli|
        cli.keys("#{config.namespace}:*").each { |key| yielder.yield(key, cli) }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
async_storage-0.0.4 lib/async_storage/bath_actions.rb
async_storage-0.0.3 lib/async_storage/bath_actions.rb
async_storage-0.0.2 lib/async_storage/bath_actions.rb
async_storage-0.0.1 lib/async_storage/bath_actions.rb