<commit_before># MemcacheCheck

  This gem is intended to help find problems with Memcached servers.
  MemcacheCheck runs a series of set and get commands against a Memcached
  server and validates the data returned. It also returns the benchmark
  time that it takes to run the get and set commands to help find slow
  responding servers.


## Installation

Add this line to your application's Gemfile:

    gem 'memcache_check'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install memcache_check


## Usage

There are now 2 primary methods to use the gem. The original single server
benchmark and the new group benchmark.

### Single

Create an instance of MemcacheCheck::Checker and pass in an argument of
the server's IP address as a string. If you don't pass an IP address in it
will default to localhost.  You can optionally pass in a second argument of
the port number if you are running memcached on a non-standard port.

Once you have an instance you simply run the start method and pass it the
number of key value pairs you want to test against the server. If you don't
pass a value in it will default to 50.

The start method returns an array of 3 numbers:

    - Number of passing set/get pairs
    - Number of failing set/get pairs
    - Benchmark time to run the test

example.rb

    ```ruby
    require 'memcache_check'

    memcache_check = MemcacheCheck::Checker.new('127.0.0.1')
    passes, fails, time = memcache_check.start(500)

    puts "Number of passes: #{passes}"
    puts "Number of failures: #{fails}"
    puts "Total time: #{time} seconds"
    ```

Running on my local machine this produces:

    Number of passes: 500
    Number of failures: 0
    Total time: 0.369204 seconds

### Group

Pass a list of hostnames and/or IP addresses to
MemcacheCheck::Checker.group_benchmark. It runs 100 set and get checks
against each hostname and returns an array of Server objects once the
benchmark has completed.

The Server attributes available are:
    - hostname   (string)
    - port       (string)
    - passes     (fixnum)
    - fails      (fixnum)
    - time       (Benchmark::Tms)

example.rb

    ```ruby
    require 'memcache_check'

    memcache_check = MemcacheCheck::Checker.group_benchmark('127.0.0.1', 'localhost', '127.0.0.1')

    memcache_check.each do |server|
      puts "Server: #{server.hostname}"
      puts "Number of passes: #{server.passes}"
      puts "Number of failures: #{server.fails}"
      puts "Total time: #{server.time.real.round(3)}"
      puts
    end
    ```
<commit_msg>Minor edit to README.<commit_after># MemcacheCheck

  This gem is intended to help find problems with Memcached servers.
  MemcacheCheck runs a series of set and get commands against a Memcached
  server and validates the data returned. It also returns the benchmark
  time that it takes to run the get and set commands to help find slow
  responding servers.


## Installation

Add this line to your application's Gemfile:

    gem 'memcache_check'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install memcache_check


## Usage

There are now 2 primary methods to use the gem. The original single server
benchmark and the new group benchmark.

### Single

Create an instance of MemcacheCheck::Checker and pass in an argument of
the server's IP address as a string. If you don't pass an IP address in it
will default to localhost.  You can optionally pass in a second argument of
the port number if you are running memcached on a non-standard port.

Once you have an instance you simply run the start method and pass it the
number of key value pairs you want to test against the server. If you don't
pass a value in it will default to 50.

The start method returns an array of 3 numbers:

    - Number of passing set/get pairs
    - Number of failing set/get pairs
    - Benchmark time to run the test

example.rb

    require 'memcache_check'

    memcache_check = MemcacheCheck::Checker.new('127.0.0.1')
    passes, fails, time = memcache_check.start(500)

    puts "Number of passes: #{passes}"
    puts "Number of failures: #{fails}"
    puts "Total time: #{time} seconds"

Running on my local machine this produces:

    Number of passes: 500
    Number of failures: 0
    Total time: 0.369204 seconds

### Group

Pass a list of hostnames and/or IP addresses to
MemcacheCheck::Checker.group_benchmark. It runs 100 set and get checks
against each hostname and returns an array of Server objects once the
benchmark has completed.

The Server attributes available are:
    - hostname   (string)
    - port       (string)
    - passes     (fixnum)
    - fails      (fixnum)
    - time       (Benchmark::Tms)

example.rb

    require 'memcache_check'

    memcache_check = MemcacheCheck::Checker.group_benchmark('127.0.0.1', 'localhost', '127.0.0.1')

    memcache_check.each do |server|
      puts "Server: #{server.hostname}"
      puts "Number of passes: #{server.passes}"
      puts "Number of failures: #{server.fails}"
      puts "Total time: #{server.time.real.round(3)}"
      puts
    end

{'fraction_non_alphanumeric': 0.0690672963400236, 'fraction_numerical': 0.015741833923652106, 'mean_word_length': 3.239366138448707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '430879', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1431, 'n_words': 671}