← lessons

List Magento cache keys in Redis CLI

Video Lesson: List Magento cache keys in Redis CLI

View and understand Magento cache key patterns using Redis CLI commands.

Mark Shust

TEACHER

Mark Shust

Published 4 months ago

Share with colleagues:

Share on X Share on LinkedIn

Lesson Content

Let's look at how Magento organizes its cache keys in Redis.

First, let's open up terminal and connect to it using the Redis CLI command:

redis-cli

If you are using Docker, be sure to connect to the container first and then execute the redis-cli command. Ex: docker-compose exec redis redis-cli

Once connected to Redis, we can view entries using the KEYS keyword.

Use a simple asterisk to return all entries in the Redis database:

KEYS *

Or, we can specify a certain pattern, such as the zc prefix to return all entries related to Magento.

KEYS zc:*

You’ll see something like this:

1) "zc:ti:69d_DB_PDO_MYSQL_DDL"
2) "zc:k:69d_SYSTEM_WEBSITES_BASE"
3) "zc:k:69d_BLOCK_71E8EF50FDE5DC1FC850CB9E158E8B3B"

Let's break down how Magento names and structures these cache entries.

First, all Magento cache entries start with zc:, which stands for "Zend Cache", the name of Magento’s underlying cache framework.

After the zc: prefix, entries will have one of two types:

  • k: means "key", and contains the actual cached content

  • ti: means "tags index", and stores cache tags that group related cache items together

The final part of each entry (69d_EAV_ATTRIBUTE) looks a bit random, but consists of:

  • A cache ID prefix that’s unique to your specific Magento instance. In this case, it is 69d.

  • Then an underscore, followed by the actual cache identifier, like EAV_ATTRIBUTE or CAT_C_3.

The exact entries you'll see depend on your specific Magento setup and what's currently cached, but they'll always follow these same patterns.

When you're done exploring, just type exit and hit Enter to exit the Redis CLI.

M.academy University
Join the All-inclusive
Magento learning University

Level-up your career with the complete Magento development solution.

Full premium course catalog

Personalized AI tutor

Friendly developer community

Learn more →
M Bytes Newsletter
Bi-weekly Magento deep-dives

Watch. Read. Apply. One topic every other week.

Fresh bytes every other Thursday. No spam. Unsubscribe anytime.


Join 9,000+ developers learning Magento, one byte at a time.