Sha256: 920b08769ec002e43b536351609957494f360bcabf814ad5ceab67280a5f60a5

Contents?: true

Size: 928 Bytes

Versions: 4

Compression:

Stored size: 928 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'
      ActiveRedisDB::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'
      ActiveRedisDB::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_redis_db-1.1.0 lib/tasks/redis.rake
active_redis_db-1.0.2 lib/tasks/redis.rake
active_redis_db-1.0.1 lib/tasks/redis.rake
active_redis_db-1.0.0 lib/tasks/redis.rake