Class: Appshot::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/appshot/app/redis.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Redis

Returns a new instance of Redis.



4
5
6
7
# File 'lib/appshot/app/redis.rb', line 4

def initialize(opts={})
  @save_before_snapshot = opts[:save_before_snapshot] || false
  @redis_binary         = opts[:database_command]     || "redis-cli"
end

Instance Method Details

#call(call_chain) ⇒ Object



9
10
11
12
13
# File 'lib/appshot/app/redis.rb', line 9

def call(call_chain)
  next_action = call_chain.shift
  invoke_save if @save_before_snapshot
  next_action.call(call_chain) unless next_action.nil?
end

#invoke_saveObject



15
16
17
# File 'lib/appshot/app/redis.rb', line 15

def invoke_save
  %x[ #{redis_binary} bgsave ]
end