Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,32 @@ config.cache_store = :solid_cache_store

You can set one of `database`, `databases` and `connects_to` in the config file. They will be used to configure the cache databases in `SolidCache::Record#connects_to`.

Setting `database` to `cache_db` will configure with:
If `connects_to` is set, it will be passed directly.

```ruby
SolidCache::Record.connects_to database: { writing: :cache_db }
```
Setting `database` is shorthand for connecting to a single database:

Setting `databases` to `[cache_db, cache_db2]` is the equivalent of:
```yaml
database: :cache_db

```ruby
SolidCache::Record.connects_to shards: { cache_db1: { writing: :cache_db1 }, cache_db2: { writing: :cache_db2 } }
# equivalent to
connects_to:
database:
writing: :cache_db
```

If `connects_to` is set, it will be passed directly.
And `databases` to `[cache_db, cache_db2]` configures multiple database shards:

```yaml
databases: [cache_db, cache_db2]

# equivalent to
connects_to:
shards:
cache_db1:
writing: :cache_db1
cache_db2:
writing: :cache_db2
```

If none of these are set, Solid Cache will use the `ActiveRecord::Base` connection pool. This means that cache reads and writes will be part of any wrapping database transaction.

Expand Down
Loading