Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

magento-indexing-caching

БесплатноБез исполняемых скриптовНе проверен

Speed up Magento by managing indexers correctly, configuring Varnish full-page cache, and using Redis for session and object caching

finsilabsот finsilabs★ 69 звёзд на GitHub

Об этом скилле

Magento Indexing and Caching

Overview

Magento's performance architecture relies on two distinct layers: indexers that pre-compute denormalized data (product prices, search indexes, category paths) into flat tables, and the Full-Page Cache (FPC) that stores complete rendered HTML pages. Varnish is the recommended FPC backend for production, replacing Magento's built-in file-based cache. Redis is the recommended backend for application cache, session storage, and the default cache (block HTML, config, layout). Misconfigured or stale indexes are one of the most common causes of incorrect pricing and product visibility issues.

When to Use This Skill

  • When products appear with wrong prices or are invisible after catalog updates
  • When implementing Varnish for the first time on a Magento production server
  • When diagnosing slow category page loads caused by on-the-fly price calculation
  • When configuring Redis for Magento's session and block cache storage
  • When setting up cache invalidation after catalog or CMS updates via Magento's cache tags
  • When managing indexer schedules on large catalogs (> 50,000 products) to prevent full reindex locking

Core Instructions

  1. Understand Magento's indexers and their modes

    # List all indexers and their status
    bin/magento indexer:info
    bin/magento indexer:status
    
    # Example output:
    # catalog_category_product    Category Products    valid    Update on Save
    # catalog_product_category    Product Categories   valid    Update on Save
    # catalog_product_price       Product Price        invalid  Update by Schedule
    # catalogsearch_fulltext      Catalog Search       valid    Update by Schedule
    # catalogrule_product         Catalog Rule Product invalid  Update on Save
    

    Set all production indexers to Update by Schedule mode to prevent checkout blocking:

    bin/magento indexer:set-mode schedule catalog_category_product
    bin/magento indexer:set-mode schedule catalog_product_price
    bin/magento indexer:set-mode schedule catalogsearch_fulltext
    bin/magento indexer:set-mode schedule catalog_product_flat
    bin/magento indexer:set-mode schedule catalog_category_flat
    
    # Verify modes
    bin/magento indexer:show-mode
    
  2. Manage indexers and partial reindexing

    # Reindex a single indexer (less disruptive than full reindex)
    bin/magento indexer:reindex catalog_product_price
    
    # Reindex all (avoid on production during business hours)
    bin/magento indexer:reindex
    
    # Reset indexer to "invalid" to force next scheduled run
    bin/magento indexer:reset catalog_product_price
    
    # Check mview (materialized view) changelog tables — lists pending rows to process
    bin/magento indexer:show-changelog
    

    For very large catalogs, use parallel indexing:

    # app/etc/env.php — enable parallel processing
    # In Admin → System → Index Management → Indexers → Configure
    # Or via config:
    bin/magento config:set dev/grid/async_indexing 1
    
    <?php
    // app/etc/env.php
    return [
        // ...
        'indexer' => [
            'batch_size' => [
                'catalog_product_price' => ['simple' => 200, 'configurable' => 50],
                'catalogsearch_fulltext' => ['simple' => 500],
            ],
        ],
    ];
    
  3. Configure Varnish as Full-Page Cache

    # In Admin → System → Configuration → Advanced → System → Full Page Cache
    # Set Caching Application: Varnish Cache
    # Export Varnish configuration:
    bin/magento varnish:vcl:generate --export-version=6 --output-file=/etc/varnish/magento.vcl
    

    Key sections of the generated VCL to understand:

    # /etc/varnish/magento.vcl (excerpts from generated config)
    
    sub vcl_recv {
        # Do not cache if private cookie is set (logged-in customer)
        if (req.http.cookie ~ "X-Magento-Vary=") {
            # Magento sets this cookie to vary cache by context (customer group, currency)
            # The cookie value changes only when the context changes — not per session
        }
    
        # Strip _ga, fbclid, utm_* params from cache key to prevent cache fragmentation
        set req.url = regsuball(req.url, "(\?|&)(utm_[^&]+|fbclid|gclid|mc_[^&]+)(&|$)", "\1");
    }
    
    sub vcl_hash {
        # Include Magento's context cookie in the cache hash
        if (req.http.cookie ~ "X-Magento-Vary=") {
            hash_data(regsub(req.http.cookie, ".*X-Magento-Vary=([^;]+).*", "\1"));
        }
    }
    
    sub vcl_backend_response {
        # Respect Magento's Cache-Control headers
        if (beresp.http.Cache-Control ~ "no-store") {
            set beresp.uncacheable = true;
            set beresp.ttl = 120s;
        }
    
        # Strip Set-Cookie on cacheable responses
        if (beresp.ttl > 0s) {
            unset beresp.http.set-cookie;
        }
    }
    
  4. Configure Redis for application cache and sessions

    <?php
    // app/etc/env.php — Redis cache and sessi
    
Полный SKILL.md на GitHub

Установить magento-indexing-caching в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

claude-code
cursor
gemini-cli
copilot
codex-cli
kiro
opencode

Вложенные файлы

evals/custom-module-cache-tag-invalidation/criteria.jsonevals/custom-module-cache-tag-invalidation/task.mdevals/indexer-production-configuration/criteria.jsonevals/indexer-production-configuration/task.mdevals/redis-cache-and-session-configuration/criteria.jsonevals/redis-cache-and-session-configuration/task.mdtile.json

FAQ

Что делает скилл magento-indexing-caching?

Speed up Magento by managing indexers correctly, configuring Varnish full-page cache, and using Redis for session and object caching

Как установить скилл magento-indexing-caching?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл magento-indexing-caching запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить magento-indexing-caching с