From c8934f3c02a921dee1b0e10cee846be447517aaf Mon Sep 17 00:00:00 2001 From: Ritikesh Date: Tue, 29 Dec 2020 13:22:24 +0530 Subject: [PATCH] add stats method on RedisCacheStore similar to MemCacheStore --- activesupport/CHANGELOG.md | 4 ++++ activesupport/lib/active_support/cache/redis_cache_store.rb | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index b9f0d6c3b74de..67b5e64d0ad38 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -6,5 +6,9 @@ *Ritikesh G* +* add `RedisCacheStore#stats` method similar to `MemCacheStore#stats`. Calls `redis#info` internally. + + *Ritikesh G* + Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activesupport/CHANGELOG.md) for previous changes. diff --git a/activesupport/lib/active_support/cache/redis_cache_store.rb b/activesupport/lib/active_support/cache/redis_cache_store.rb index 1afecb3fb72a8..fe93d039b28e8 100644 --- a/activesupport/lib/active_support/cache/redis_cache_store.rb +++ b/activesupport/lib/active_support/cache/redis_cache_store.rb @@ -319,6 +319,11 @@ def clear(options = nil) end end + # Get info from redis servers. + def stats + redis.with { |c| c.info } + end + def mget_capable? #:nodoc: set_redis_capabilities unless defined? @mget_capable @mget_capable