Skip to content

Commit 0c97d1d

Browse files
Reorganize "Cache Stores" sections [ci-skip]
This makes "Connection Pool Options" a subsection of "Configuration", instead of a subsection of "ActiveSupport::Cache::Store". This also makes "Custom Cache Stores" its own section after all of the built-in stores, instead of a subsection of "ActiveSupport::Cache::Store".
1 parent 2e9efbb commit 0c97d1d

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

guides/source/caching_with_rails.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,6 @@ Alternatively, you can set `ActionController::Base.cache_store` outside of a con
373373

374374
You can access the cache by calling `Rails.cache`.
375375

376-
### `ActiveSupport::Cache::Store`
377-
378-
[`ActiveSupport::Cache::Store`][] provides the foundation for interacting with the cache in Rails. This is an abstract class, and you cannot use it on its own. Instead, you must use a concrete implementation of the class tied to a storage engine. Rails ships with several implementations, documented below.
379-
380-
The main API methods are [`read`][ActiveSupport::Cache::Store#read], [`write`][ActiveSupport::Cache::Store#write], [`delete`][ActiveSupport::Cache::Store#delete], [`exist?`][ActiveSupport::Cache::Store#exist?], and [`fetch`][ActiveSupport::Cache::Store#fetch].
381-
382-
Options passed to the cache store's constructor will be treated as default options for the appropriate API methods.
383-
384-
[`ActiveSupport::Cache::Store`]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
385-
[ActiveSupport::Cache::Store#delete]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-delete
386-
[ActiveSupport::Cache::Store#exist?]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-exist-3F
387-
[ActiveSupport::Cache::Store#fetch]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch
388-
[ActiveSupport::Cache::Store#read]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-read
389-
[ActiveSupport::Cache::Store#write]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-write
390-
391376
#### Connection Pool Options
392377

393378
By default, [`:mem_cache_store`](#activesupport-cache-memcachestore) and
@@ -411,18 +396,20 @@ config.cache_store = :mem_cache_store, "cache.example.com", pool: { size: 32, ti
411396

412397
* `:timeout` - This option sets the number of seconds to wait for a connection (defaults to 5). If no connection is available within the timeout, a `Timeout::Error` will be raised.
413398

414-
#### Custom Cache Stores
399+
### `ActiveSupport::Cache::Store`
415400

416-
You can create your own custom cache store by simply extending
417-
`ActiveSupport::Cache::Store` and implementing the appropriate methods. This way,
418-
you can swap in any number of caching technologies into your Rails application.
401+
[`ActiveSupport::Cache::Store`][] provides the foundation for interacting with the cache in Rails. This is an abstract class, and you cannot use it on its own. Instead, you must use a concrete implementation of the class tied to a storage engine. Rails ships with several implementations, documented below.
419402

420-
To use a custom cache store, simply set the cache store to a new instance of your
421-
custom class.
403+
The main API methods are [`read`][ActiveSupport::Cache::Store#read], [`write`][ActiveSupport::Cache::Store#write], [`delete`][ActiveSupport::Cache::Store#delete], [`exist?`][ActiveSupport::Cache::Store#exist?], and [`fetch`][ActiveSupport::Cache::Store#fetch].
422404

423-
```ruby
424-
config.cache_store = MyCacheStore.new
425-
```
405+
Options passed to the cache store's constructor will be treated as default options for the appropriate API methods.
406+
407+
[`ActiveSupport::Cache::Store`]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
408+
[ActiveSupport::Cache::Store#delete]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-delete
409+
[ActiveSupport::Cache::Store#exist?]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-exist-3F
410+
[ActiveSupport::Cache::Store#fetch]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch
411+
[ActiveSupport::Cache::Store#read]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-read
412+
[ActiveSupport::Cache::Store#write]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-write
426413

427414
### `ActiveSupport::Cache::MemoryStore`
428415

@@ -577,6 +564,19 @@ config.cache_store = :null_store
577564

578565
[`ActiveSupport::Cache::NullStore`]: https://api.rubyonrails.org/classes/ActiveSupport/Cache/NullStore.html
579566

567+
### Custom Cache Stores
568+
569+
You can create your own custom cache store by simply extending
570+
`ActiveSupport::Cache::Store` and implementing the appropriate methods. This way,
571+
you can swap in any number of caching technologies into your Rails application.
572+
573+
To use a custom cache store, simply set the cache store to a new instance of your
574+
custom class.
575+
576+
```ruby
577+
config.cache_store = MyCacheStore.new
578+
```
579+
580580
Cache Keys
581581
----------
582582

0 commit comments

Comments
 (0)