Skip to content

Commit

Permalink
Update documentation with instructions for Rails.cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors Baltus committed Jan 17, 2022
1 parent 934a5a9 commit 0205414
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 0205414

Please # to comment.