Deprecate direct access of Gitlab::Redis::Cache in favor of Rails.cache

As mentioned in https://gitlab.com/gitlab-org/gitlab-ce/issues/64794#note_193946370, we should consider deprecating the use of Gitlab::Redis::Cache.with in favor of Rails.cache because the new RedisCacheStore introduced in Rails 5.2 (https://github.com/rails/rails/pull/31134) supports a number of features that we could use:

I'm not sure if we can port calls to HMSET to write_multi_entries and HMGET to read_multi_entries. We also use other Redis primitives, such as SMEMBERS and SCARD. We could punt on the problem and just using the shared state cache in some cases.

$ git grep Gitlab::Redis::Cache.with
config/initializers/7_redis.rb:Gitlab::Redis::Cache.with { nil }
lib/gitlab/action_rate_limiter.rb:      Gitlab::Redis::Cache.with do |redis|
lib/gitlab/cache/ci/project_pipeline_status.rb:          Gitlab::Redis::Cache.with do |redis|
lib/gitlab/cache/ci/project_pipeline_status.rb:          Gitlab::Redis::Cache.with do |redis|
lib/gitlab/cache/ci/project_pipeline_status.rb:          Gitlab::Redis::Cache.with do |redis|
lib/gitlab/cache/ci/project_pipeline_status.rb:          Gitlab::Redis::Cache.with do |redis|
lib/gitlab/external_authorization/cache.rb:        @access, @reason, @refreshed_at = ::Gitlab::Redis::Cache.with do |redis|
lib/gitlab/external_authorization/cache.rb:        ::Gitlab::Redis::Cache.with do |redis|
lib/gitlab/health_checks/redis/cache_check.rb:              Gitlab::Redis::Cache.with(&:ping)
lib/gitlab/markdown_cache/redis/store.rb:          Gitlab::Redis::Cache.with do |r|
lib/gitlab/markdown_cache/redis/store.rb:          results = Gitlab::Redis::Cache.with do |r|
lib/gitlab/shard_health_cache.rb:      Gitlab::Redis::Cache.with { |redis| redis.del(HEALTHY_SHARDS_KEY) }
lib/gitlab/shard_health_cache.rb:      Gitlab::Redis::Cache.with do |redis|
lib/gitlab/shard_health_cache.rb:      Gitlab::Redis::Cache.with { |redis| redis.smembers(HEALTHY_SHARDS_KEY) }
lib/gitlab/shard_health_cache.rb:      Gitlab::Redis::Cache.with { |redis| redis.sismember(HEALTHY_SHARDS_KEY, shard_name) }
lib/gitlab/shard_health_cache.rb:      Gitlab::Redis::Cache.with { |redis| redis.scard(HEALTHY_SHARDS_KEY) }
lib/tasks/cache.rake:      Gitlab::Redis::Cache.with do |redis|
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:      read_sha, read_status = Gitlab::Redis::Cache.with { |redis| redis.hmget(cache_key, :sha, :status) }
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:      sha, status, ref = Gitlab::Redis::Cache.with { |redis| redis.hmget(cache_key, :sha, :status, :ref) }
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:      sha, status = Gitlab::Redis::Cache.with { |redis| redis.hmget(cache_key, :sha, :status) }
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:      Gitlab::Redis::Cache.with do |redis|
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:      sha, status, ref = Gitlab::Redis::Cache.with { |redis| redis.hmget("projects/#{empty_project.id}/pipeline_status", :sha, :status, :ref) }
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:      Gitlab::Redis::Cache.with do |redis|
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:          Gitlab::Redis::Cache.with do |redis|
spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb:        key_exists = Gitlab::Redis::Cache.with { |redis| redis.exists(cache_key) }
spec/lib/gitlab/discussions_diff/highlight_cache_spec.rb:        found = Gitlab::Redis::Cache.with { |r| r.get(full_key) }
spec/lib/gitlab/external_authorization/cache_spec.rb:    Gitlab::Redis::Cache.with do |redis|
spec/lib/gitlab/external_authorization/cache_spec.rb:    Gitlab::Redis::Cache.with do |redis|
spec/lib/gitlab/github_import/caching_spec.rb:      values = Gitlab::Redis::Cache.with { |r| r.smembers(key) }
spec/lib/gitlab/github_import/caching_spec.rb:        found = Gitlab::Redis::Cache.with { |r| r.get(full_key) }
spec/lib/gitlab/github_import/caching_spec.rb:      found_ttl = Gitlab::Redis::Cache.with { |r| r.ttl(key) }
spec/lib/gitlab/markdown_cache/redis/extension_spec.rb:    Gitlab::Redis::Cache.with do |r|
spec/lib/gitlab/markdown_cache/redis/extension_spec.rb:      results = Gitlab::Redis::Cache.with do |r|
spec/lib/gitlab/markdown_cache/redis/store_spec.rb:    Gitlab::Redis::Cache.with do |r|
spec/lib/gitlab/markdown_cache/redis/store_spec.rb:    Gitlab::Redis::Cache.with do |r|
spec/services/git/branch_push_service_spec.rb:      Gitlab::Redis::Cache.with { |conn| conn.flushall }
spec/services/git/branch_push_service_spec.rb:      Gitlab::Redis::Cache.with { |conn| conn.flushall }
spec/support/redis/redis_helpers.rb:    Gitlab::Redis::Cache.with(&:flushall)
spec/support/shared_examples/unique_ip_check_shared_examples.rb:    Gitlab::Redis::Cache.with(&:flushall)
Edited by Stan Hu