<commit_before># BattleShip

#### Description
The BattleShip gem answers the question "What is my cache hit rate?"

It does this by adding an increment to every cache read operation,
counting each read as either a hit (returned non-nil value) or miss (returned
nil). It stores the resulting numbers of hits and misses in the cache itself.

BattleShip assumes you are caching objects (such as a User or Session object). On a hit, it
will see the class name and increment the hit count at
```"#{returned_object.class}_hits"```, where returned_object is the object that
the cache call returns. On a miss, BattleShip assumes that the key represents
the class name (e.g. you called Rails.cache.read("user_1")), and increments the
miss counter accordingly (e.g. at "user_misses"). If you pass in a ```:namespace``` key in the options
hash, it will use that instead.

## Usage

Cache things just liek you do with Rails.cache methods already.

Access the hits by calling ```#hits``` on your particular cache implementation (e.g.
  ```Rails.cache.hits```) and passing in the namespace, e.g. User (either the string
or the classname).
Same deal with misses, but call ```#misses``` instead

#### Installation

Add this line to your application's Gemfile:

    gem 'battle_ship'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install battle_ship


#### Warnings, Caveats, etc.
If you are using a cache store that does not subclass ActiveSupport::Cache::Store, then ```gem 'battle_ship``` must be listed _after_ the cache store you're using (the only example I'm currently aware of is Dalli).


## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)<commit_msg>Update README with config/init option<commit_after># BattleShip

#### Description
The BattleShip gem answers the question "What is my cache hit rate?"

It does this by adding an increment to every cache read operation,
counting each read as either a hit (returned non-nil value) or miss (returned
nil). It stores the resulting numbers of hits and misses in the cache itself.

BattleShip assumes you are caching objects (such as a User or Session object). On a hit, it
will see the class name and increment the hit count at
```"#{returned_object.class}_hits"```, where returned_object is the object that
the cache call returns. On a miss, BattleShip assumes that the key represents
the class name (e.g. you called Rails.cache.read("user_1")), and increments the
miss counter accordingly (e.g. at "user_misses"). If you pass in a ```:namespace``` key in the options
hash, it will use that instead.

## Usage

Cache things just liek you do with Rails.cache methods already.

Access the hits by calling ```#hits``` on your particular cache implementation (e.g.
  ```Rails.cache.hits```) and passing in the namespace, e.g. User (either the string
or the classname).
Same deal with misses, but call ```#misses``` instead

#### Installation

Add this line to your application's Gemfile:

    gem 'battle_ship'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install battle_ship


#### Warnings, Caveats, etc.
If you are using a cache store that does not subclass ActiveSupport::Cache::Store, please add an initializer file in ```config/initializers``` that calls ```BattleShip.include!```


## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
{'fraction_non_alphanumeric': 0.091033726350425, 'fraction_numerical': 0.002741979709350151, 'mean_word_length': 4.364705882352941, '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': '1476204', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1006, 'n_words': 530}