This command provides a summary of the use of a Redis database by the Drupal 10 or Drupal 9 cache provider.
It relies on Redis SCAN
operator instead of KEYS
, so it won't block your
site when used on production.
Assuming Go 1.21 or later installed:
go get -u github.com/fgm/drupal_redis_stats
-h
provides help-dsn
flag allows using a non-default Redis-dsn redis://<host>:<port>/<db>
without authentication-dsn redis://<password>@<host>:<port>/<db>
forrequirepass
AUTH mode-dsn redis://<user>:<password>@<host>:<port>/<db>
for ACL AUTH mode
-json
provides JSON output instead of the default human-readable format-q
disables the progress bar used during the database SCAN loop
Bin | Entries | Size
-------------------+---------+---------
bootstrap | 10 | 6056
config | 7992 | 4741812
data | 10483 | 7717813
default | 183 | 130061
discovery | 240 | 164028
dynamic_page_cache | 6104 | 11225548
entity | 785 | 506817
menu | 28 | 30646
page | 6125 | 5222326
render | 12877 | 19965812
-------------------+---------+---------
Total | 44832 | 49714857
The Entries column provides the number of entries in a cache bin,
while the Size bin provides the size used by keys and data in Redis
storage, based on information provided by the MEMORY USAGE
command.