Module: Orats::Redis
- Included in:
- Common
- Defined in:
- lib/orats/redis.rb
Overview
manage the redis process
Instance Method Summary collapse
- #drop_namespace(namespace) ⇒ Object
- #exit_if_redis_unreachable ⇒ Object
- #redis_bin(bin_name = 'redis-cli') ⇒ Object
Instance Method Details
#drop_namespace(namespace) ⇒ Object
11 12 13 14 |
# File 'lib/orats/redis.rb', line 11 def drop_namespace(namespace) run "#{redis_bin} KEYS '#{namespace}:*'| " + \ "xargs --delim='\n' #{redis_bin} DEL" end |
#exit_if_redis_unreachable ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/orats/redis.rb', line 16 def exit_if_redis_unreachable task 'Check if you can ping redis' return if run("#{redis_bin} ping") error 'Cannot ping redis', 'attempt to PING' exit 1 end |
#redis_bin(bin_name = 'redis-cli') ⇒ Object
4 5 6 7 8 9 |
# File 'lib/orats/redis.rb', line 4 def redis_bin(bin_name = 'redis-cli') exec = "#{bin_name} -h #{@options[:redis_location]}" return exec if @options[:redis_password].empty? exec << " -a #{@options[:redis_password]}" end |