Use built-in Redis cache store in Rails 5.2
This is required for https://gitlab.com/gitlab-org/gitlab-ce/issues/64142
Now that GitLab is running Rails 5.2: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/12145, we should investigate moving over to the built-in Redis cache store that comes with Rails 5.2.
This feature arrived via this change: https://github.com/rails/rails/pull/31134
Highlighted features relevant to GitLab:
- Supports vanilla Redis, hiredis, and Redis::Distributed (required for https://gitlab.com/gitlab-org/gitlab-ce/issues/64142)
- Supports Memcached-like sharding across Redises with Redis::Distributed (required for https://gitlab.com/gitlab-org/gitlab-ce/issues/64142)
- Fault tolerant. If the Redis server is unavailable, no exceptions are raised. Cache fetches are treated as misses and writes are dropped.
- Local cache. Hot in-memory primary cache within block/middleware scope. Will this mean we don't need? https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30368
Deployment note: Take care to use a dedicated Redis cache rather than pointing this at your existing Redis server. It won't cope well with mixed usage patterns and it won't expire cache entries by default.
This may complicate the deployment of this change.