Skip to main content
added 178 characters in body
Source Link
MauroNigrele
  • 3k
  • 1
  • 19
  • 28

You can inject \Magento\Framework\App\CacheInterface\Magento\Framework\App\CacheInterface as dependency and assign it to ($__cacheManager)$_cacheManager in your constructor or get it from de $context$context (if you have) and then after save changes clean the related cache that way:

$this->_cacheManager->clean(array(tags[tag1,tag2..tagN]));

youYou could find a complete implementation in Catalog\Product\Model

I guess you could use the "get" method of the ObjectManager to get the cache instance too, but I'm not sure if is a good practice.

You can inject \Magento\Framework\App\CacheInterface as ($__cacheManager) in your constructor or get it from de $context (if you have) and then after save changes clean the related cache that way:

$this->_cacheManager->clean(array(tags));

you could find a complete implementation in Catalog\Product\Model

You can inject \Magento\Framework\App\CacheInterface as dependency and assign it to $_cacheManager in your constructor or get it from de $context (if you have) and then after save changes clean the related cache that way:

$this->_cacheManager->clean(array([tag1,tag2..tagN]));

You could find a complete implementation in Catalog\Product\Model

I guess you could use the "get" method of the ObjectManager to get the cache instance too, but I'm not sure if is a good practice.

Source Link
MauroNigrele
  • 3k
  • 1
  • 19
  • 28

You can inject \Magento\Framework\App\CacheInterface as ($__cacheManager) in your constructor or get it from de $context (if you have) and then after save changes clean the related cache that way:

$this->_cacheManager->clean(array(tags));

you could find a complete implementation in Catalog\Product\Model