<commit_before>module Merb
  module Cache
    module ControllerClassMethods
    
      def cache_action(action, options = {}, &block)
        # Get the filter options
        opts = {}
        [:exclude, :only, :with].each{ |k| r = options.delete(k); opts.merge!(r) if r}
        
        # setup the options for the before_filter
        opts.delete(:exclude)
        opts[:only] = action
        
        _add_action_cache(action, options, &block)
        
        # Setup a before filter 
        b = Proc.new do
          _fetch_action_cache(options)
        end
        a = Proc.new do
          _set_action_cache(options)
        end
        before  nil, opts, &b
        after   nil, opts, &a
      end
    
      # Pure convenience
      def cache_actions(*args, &block)
        options = args.pop if Hash === args.last
        options ||= {}
        opts = {}
        [:exclude, :only, :with].each{ |k| r = options.delete(k); opts.merge!(r) if r}
        
        if args.empty?
          unless opts[:exclude]
            args = self.callable_actions
            opts[:only] = args.flatten
          end
        end
      
        # Setup a before filter and after filter
        b = Proc.new do
          _fetch_action_cache(options)
        end
        a = Proc.new do
          _set_action_cache(options)
        end
        before  nil, opts, &b
        after   nil, opts, &a
      end
    
      def cached_action?(action)
        raise NotImplmented
        # Merb::Cache::Store.get(Merb::Cache.key_for(action)).nil?
      end
    
      def expire_action
        raise NotImplemented
      end
    
      # Pure convenience
      def expire_actions(actions)<commit_msg>Makes sure that the action cache is getting setup on the controller with cache_actions<commit_after>module Merb
  module Cache
    module ControllerClassMethods
    
      def cache_action(action, options = {}, &block)
        # Get the filter options
        opts = {}
        opts = normalize_filters!(opts || {})
        
        # setup the options for the before_filter
        opts.delete(:exclude)
        opts[:only] = action
        
        _add_action_cache(action, options, &block)
        
        # Setup a before filter 
        b = Proc.new do
          _fetch_action_cache(options)
        end
        a = Proc.new do
          _set_action_cache(options)
        end
        
        # Using procs so that we can run multiple filters on _fetch_action_cache and _set_action_cache
        before  nil, opts, &b
        after   nil, opts, &a
      end
    
      # Pure convenience
      def cache_actions(*args, &block)
        options = args.pop if Hash === args.last
        options ||= {}
        opts = normalize_filters!(opts || {})
        
        case opts.keys
        when include?(:exclude)
          actions = self.callable_actions - opts[:exclude]        
        when include?(:only)
          actions = opts[:only]
        else
          actions = args.empty? ? self.callable_actions : args.flatten
        end

        # Setup the cache store on the controller
        actions.each{|a| _add_action_cache(action.to_sym, options, &block)}
      
        # Setup a before filter and after filter
        b = Proc.new do
          _fetch_action_cache(options)
        end
        a = Proc.new do
          _set_action_cache(options)
        end
        
        # Using procs so that we can run multiple filters on _fetch_action_cache and _set_action_cache
        before  nil, opts, &b
        after   nil, opts, &a
      end
    
      def cached_action?(action)
        raise NotImplmented
        # Merb::Cache::Store.get(Merb::Cache.key_for(action)).nil?
      end
    
      def expire_action
        raise NotImplemented
      end
    
      # Pure convenience
      def expire_actions(actions)
{'fraction_non_alphanumeric': 0.0804929208180388, 'fraction_numerical': 0.0, 'mean_word_length': 1.7172364672364673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6246992', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1058, 'n_words': 303}