AD0-E716 · Question #25
An Adobe Commerce developer is tasked with creating a custom block that will be displayed on every page in the footer of the site. After completing and optimizing the development, the developer…
The correct answer is C. Set values for both cache_lifetime and cache_key data properties of the block. To store a block in the system cache, the developer needs to set values for both the cache_lifetime and cache_key data properties of the block. The cache_lifetime property specifies how long the block should be cached, and the cache_key property specifies a unique identifier…
Question
An Adobe Commerce developer is tasked with creating a custom block that will be displayed on every page in the footer of the site. After completing and optimizing the development, the developer notices that the block takes too for all cache groups. What would be the minimum requirement to achieve this?
Options
- ASet a value for the cache_Lifetime data property of the block.
- BSet a value for cache_key data property of the block.
- CSet values for both cache_lifetime and cache_key data properties of the block.
How the community answered
(28 responses)- A18% (5)
- B7% (2)
- C75% (21)
Explanation
To store a block in the system cache, the developer needs to set values for both the cache_lifetime and cache_key data properties of the block. The cache_lifetime property specifies how long the block should be cached, and the cache_key property specifies a unique identifier for the block. The following code shows how to set the cache_lifetime and cache_key data properties of a block: $block->setData('cache_lifetime', 600); $block->setData('cache_key', 'my_custom_block'); Once the cache_lifetime and cache_key data properties have been set, the block will be stored in the system cache and will not be regenerated on each page load.
Topics
Community Discussion
No community discussion yet for this question.