<commit_before>begin
  require "riak"
rescue LoadError
  puts "You need the riak-client gem to use the Redis store"
  exit
end

module Moneta
  module Adapters
    class Riak
      include Defaults

      def initialize(options = {})
        bucket = options.delete(:bucket) || 'cache'
        @content_type = options.delete(:content_type) || 'application/x-ruby-marshal'
        @cache = ::Riak::Client.new(options)[bucket]
      end

      def key?(key, *)
        !!self[key]
      end

      def [](key)
        begin
          result = @cache.get(key_for(key))
          result && result.data
        rescue ::Riak::FailedRequest => e
          if e.code.to_i == 404<commit_msg>Updated riak install message.<commit_after>begin
  require "riak"
rescue LoadError
  puts "You need the riak-client gem (>= 0.8) to use the Riak store. \
          If 0.8 is not released yet, gem install riak-client --pre to get it."
  exit
end

module Moneta
  module Adapters
    class Riak
      include Defaults

      def initialize(options = {})
        bucket = options.delete(:bucket) || 'cache'
        @content_type = options.delete(:content_type) || 'application/x-ruby-marshal'
        @cache = ::Riak::Client.new(options)[bucket]
      end

      def key?(key, *)
        !!self[key]
      end

      def [](key)
        begin
          result = @cache.get(key_for(key))
          result && result.data
        rescue ::Riak::FailedRequest => e
          if e.code.to_i == 404
{'fraction_non_alphanumeric': 0.11684782608695653, 'fraction_numerical': 0.006793478260869565, 'mean_word_length': 2.2660753880266076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '895670', 'n_tokens_mistral': 472, 'n_tokens_neox': 456, 'n_words': 124}