Sha256: b91be8704ed2f812640f3f30f3fa72009310db82514d8e72bf208b5432103f27

Contents?: true

Size: 934 Bytes

Versions: 8

Compression:

Stored size: 934 Bytes

Contents

# frozen_string_literal: true

namespace :db do
  namespace :redis do

    desc 'Reset Redis database'
    task reset: :environment do
      puts '== Reset: reseting Redis '.ljust(80, '=')
      total_task_start_time = Time.current

      puts '  -> Resetting'
      ActiveOrm::Redis::Connection.flush

      total_task_elapsed_time = (Time.current - total_task_start_time).round(5)
      puts "== Reset: reset Redis (#{total_task_elapsed_time}s) ".ljust(80, '=')
      puts ''
    end

    desc 'Reset all Redis databases'
    task reset_all: :environment do
      puts '== Reset: reseting all Redis '.ljust(80, '=')
      total_task_start_time = Time.current

      puts '  -> Resetting'
      ActiveOrm::Redis::Connection.flush_all

      total_task_elapsed_time = (Time.current - total_task_start_time).round(5)
      puts "== Reset: reset all Redis (#{total_task_elapsed_time}s) ".ljust(80, '=')
      puts ''
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_orm-5.1.0 lib/tasks/redis.rake
active_orm-5.0.6 lib/tasks/redis.rake
active_orm-5.0.5 lib/tasks/redis.rake
active_orm-5.0.4 lib/tasks/redis.rake
active_orm-5.0.3 lib/tasks/redis.rake
active_orm-5.0.2 lib/tasks/redis.rake
active_orm-5.0.1 lib/tasks/redis.rake
active_orm-5.0.0 lib/tasks/redis.rake