Skip to content

Commit

Permalink
Merge pull request #1560 from xtr3me/rails_cache_store
Browse files Browse the repository at this point in the history
Update documentation with instructions for Rails.cache
  • Loading branch information
alexreisner authored Jan 17, 2022
2 parents 7a511d5 + 0205414 commit f480e76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,16 @@ This example uses Redis, but the cache store can be any object that supports the

Even a plain Ruby hash will work, though it's not a great choice (cleared out when app is restarted, not shared between app instances, etc).

When using Rails use the Generic cache store as an adapter around `Rails.cache`:

```ruby
Geocoder.configure(cache: Geocoder::CacheStore::Generic.new(Rails.cache, {}))
```

You can also set a custom prefix to be used for cache keys:

```ruby
Geocoder.configure(cache_prefix: "...")
Geocoder.configure(cache_options: { prefix: "..." })
```

By default the prefix is `geocoder:`
Expand Down

0 comments on commit f480e76

Please # to comment.