Sha256: 56a94a53657086849aabddb7c376f585f0e36ffd75a089db5231abef1507cb51

Contents?: true

Size: 902 Bytes

Versions: 4

Compression:

Stored size: 902 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
active_orm-2.4.0 lib/tasks/redis.rake
active_orm-2.3.0 lib/tasks/redis.rake
active_orm-2.2.0 lib/tasks/redis.rake
active_orm-2.1.0 lib/tasks/redis.rake