<commit_before># DbCachedModelMethods

## Install

Add to your Gemfile and bundle:
```ruby
gem "db_cached_model_methods"
```

Add a migration to create the extra tables in your database:
```ruby
class CreateUsersCache < ActiveRecord::Migration
  def up
    User.create_cached_methods_table!
  end

  def down
    User.drop_cached_methods_table!
  end
end
```

## Usage

Include in your model and specify which methods to add cache versions for:

```ruby
class User < ActiveRecord::Base
  include DbCachedModelMethods

  cache_method_in_db method: :heavy_method, type: :integer

  def heavy_method
    ...
  end
end<commit_msg>Place "cache_method_in_db" call correctly<commit_after># DbCachedModelMethods

## Install

Add to your Gemfile and bundle:
```ruby
gem "db_cached_model_methods"
```

Add a migration to create the extra tables in your database:
```ruby
class CreateUsersCache < ActiveRecord::Migration
  def up
    User.create_cached_methods_table!
  end

  def down
    User.drop_cached_methods_table!
  end
end
```

## Usage

Include in your model and specify which methods to add cache versions for:

```ruby
class User < ActiveRecord::Base
  include DbCachedModelMethods

  def heavy_method
    ...
  end
  cache_method_in_db method: :heavy_method, type: :integer
end
{'fraction_non_alphanumeric': 0.07349491790461297, 'fraction_numerical': 0.0, 'mean_word_length': 4.5895196506550215, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4949408', 'n_tokens_mistral': 415, 'n_tokens_neox': 387, 'n_words': 132}