<commit_before># Copyright 2011-present <NAME>. All Rights Reserved.

autoload :Memcached, 'memcached'

module MyStuff
  module Cache
    # Memcache-base cached.
    #
    # If you want to use this, you know what it does.
    class MemcachedCache < MyStuff::Cache::Base
      def initialize memcached
        @mc = memcached
      end

      def get keys
        results = @mc.get(keys) unless keys.empty?
        keys.map{|k| results[k]}
      end

      def set values
        values.each do |k,v|
          @mc.set(k, v, 0)
        end
      end
    end
  end<commit_msg>Catch memcached errors<commit_after># Copyright 2011-present <NAME>. All Rights Reserved.

autoload :Memcached, 'memcached'

module MyStuff
  module Cache
    # Memcache-base cached.
    #
    # If you want to use this, you know what it does.
    class MemcachedCache < MyStuff::Cache::Base
      def initialize memcached
        @mc = memcached
      end

      def get keys
        begin
          results = @mc.get(keys) unless keys.empty?
          keys.map{|k| results[k]}
        rescue Memcached::Error => e
          LOG :warning, e
          [nil] * keys.size
        end
      end

      def set values
        begin
          values.each do |k,v|
            @mc.set(k, v, 0)
          end
        rescue Memcached::Error => e
          LOG :warning, e
        end
      end
    end
  end
{'fraction_non_alphanumeric': 0.08594319009468318, 'fraction_numerical': 0.007283321194464676, 'mean_word_length': 1.7983706720977597, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1672333', 'n_tokens_mistral': 430, 'n_tokens_neox': 415, 'n_words': 137}