AdobeDocs / AdobeDocs/commerce-php

Using a custom created cache type is not clearly explained

Open
#187 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
11
Forks
177
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Which topic?

https://developer.adobe.com/commerce/php/development/cache/partial/cache-type/

### What's wrong with the content?

Creating a cache type is super clear. But when it comes to using it there are questions that come up.
The biggest question is why when you create a cache type and declare it in cache.xml don't you use it instead of using CacheInterface (as shown). Every Magento module uses its own type in the constructor and saves/loads data through it. That grants you automatic checking if the cache is enabled or disabled (if you use CacheInterface which instantiates Magento\Framework\App\Cache\Proxy that does not work) and autopopulating the default cache tag of your custom cache type (if you use CacheInterface you are responsible for adding your tag).

### What changes do you propose?

If the above is correct. I propose to show the usage of the newly created cache by injecting your own type and using it instead of CacheInterface. Feel free to correct my why this should not happen.

### Anything else that can help to cover this?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the cache type documentation at the linked page and review its existing CacheInterface usage against the proposed custom cache type injection. Verify the claims about enabled or disabled checks and default cache tags before revising the usage example. Done means the page explains how to use a newly created cache type and why that approach is preferred, or corrects the rationale.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.