diff --git a/Block/Listpost.php b/Block/Listpost.php index 5dbbb2ea..7eddfe2f 100644 --- a/Block/Listpost.php +++ b/Block/Listpost.php @@ -22,17 +22,19 @@ namespace Mageplaza\Blog\Block; use Exception; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Phrase; use Magento\Theme\Block\Html\Pager; use Mageplaza\Blog\Model\Config\Source\DisplayType; +use Mageplaza\Blog\Model\Post; use Mageplaza\Blog\Model\ResourceModel\Post\Collection; /** * Class Listpost * @package Mageplaza\Blog\Block\Post */ -class Listpost extends Frontend +class Listpost extends Frontend implements IdentityInterface { /** * @return Collection @@ -209,4 +211,11 @@ public function getBlogTitle($meta = false) return $pageTitle; } + + public function getIdentities() + { + return [ + Post::CACHE_TAG + ]; + } } diff --git a/Model/Post.php b/Model/Post.php index 10f483bc..a3161347 100755 --- a/Model/Post.php +++ b/Model/Post.php @@ -23,6 +23,7 @@ use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory; use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\DataObject\IdentityInterface; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Model\AbstractModel; use Magento\Framework\Model\Context; @@ -94,7 +95,7 @@ * @method array getTopicsIds() * @method Post setTopicsIds(array $topicIds) */ -class Post extends AbstractModel +class Post extends AbstractModel implements IdentityInterface { /** * Cache tag @@ -319,7 +320,10 @@ public function getUrl($store = null) */ public function getIdentities() { - return [self::CACHE_TAG . '_' . $this->getId()]; + return [ + self::CACHE_TAG, + self::CACHE_TAG . '_' . $this->getId() + ]; } /**