<commit_before>class RouteAction
  include EventMachine::Deferrable

  class << self
    def controller(name, app)
      controllers[name] ||= Object.const_get(name).new(app)
    end

    def controllers
      @controllers ||= {}
    end
  end

  attr_writer :callback
  attr_reader :action, :app, :route

  def initialize(app, action:, route:, callback:)
    @app, @action, @callback, @route = app, action, callback, route
  end

  def last_action
    @callback.nil? ? self : @callback.last_action
  end

  def run(request, response, finish_proc)
    next_proc = -> do
      if response.flushed?
        fail
        finish_proc.call
      else
        setup_callback
        succeed(request, response, finish_proc)
      end
    end

    if route.cache?
      app.runtime.action_cache.handle_route_action(self, request: request, response: response, next_proc: next_proc)<commit_msg>Update to only use action caching if app caching is enabled<commit_after>class RouteAction
  include EventMachine::Deferrable

  class << self
    def controller(name, app)
      controllers[name] ||= Object.const_get(name).new(app)
    end

    def controllers
      @controllers ||= {}
    end
  end

  attr_writer :callback
  attr_reader :action, :app, :route

  def initialize(app, action:, route:, callback:)
    @app, @action, @callback, @route = app, action, callback, route
  end

  def last_action
    @callback.nil? ? self : @callback.last_action
  end

  def run(request, response, finish_proc)
    next_proc = -> do
      if response.flushed?
        fail
        finish_proc.call
      else
        setup_callback
        succeed(request, response, finish_proc)
      end
    end

    if route.cache? && app.runtime.config.cache_app
      app.runtime.action_cache.handle_route_action(self, request: request, response: response, next_proc: next_proc)
{'fraction_non_alphanumeric': 0.09588299024918744, 'fraction_numerical': 0.0, 'mean_word_length': 3.0682819383259914, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1974031', 'n_tokens_mistral': 575, 'n_tokens_neox': 553, 'n_words': 148}