class ZuoraConnect::AppInstanceBase

def api_limit(start: true, time: API_LIMIT_TIMEOUT.to_i)

## START Resque Helping Methods ####
def api_limit(start: true, time: API_LIMIT_TIMEOUT.to_i)
  if start
    # Redis.current.setex("APILimits:#{self.id}", time, true)
    Redis.current.zadd("APILimits", Time.now.to_i + time, self.id)
  else
    # Redis.current.del("APILimits:#{self.id}")
    Redis.current.zrem("APILimits", self.id)
  end
end