Sha256: e147a67b187c3b0274963934ffda9dd8618b6f5edf90b3b05b8f9b1e0239837b

Contents?: true

Size: 903 Bytes

Versions: 4

Compression:

Stored size: 903 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-4.0.3 lib/tasks/redis.rake
active_orm-4.0.2 lib/tasks/redis.rake
active_orm-4.0.1 lib/tasks/redis.rake
active_orm-4.0.0 lib/tasks/redis.rake