def call(env)
      req = Rack::Request.new(env)
      controller = Heartcheck::App::ROUTE_TO_CONTROLLER[req.path_info]

      if controller && (result = cache.result(controller))
        [200, { 'Content-type' => 'application/json' }, [result]]
      else
        @app.call(env)
      end
    end
def call(env)
      req = Rack::Request.new(env)
      controller = Heartcheck::App::ROUTE_TO_CONTROLLER[req.path_info]

      if controller && (result = cache.result(controller))
        [200, { 'Content-type' => 'application/json' }, [result]]
      else
        @app.call(env)
      end
    end
Creates an instance of the middleware

 @param app [Heartcheck:App] the Rack app to wrap around
 @param ttl [Integer] the time to cache the results in seconds
 @param cache [Heartcheck::CachingApp::Cache] the cache instance to use
   The cache will be created on first use if not supplied

 @return [#call] rack compatible middleware
 Invokes the middleware

 @param env [Hash] the rack request/environment
 @return [Array] a rack compatible response