Jan Walraven
DevOps



Categories:
  • Arduino (2)
  • CSS (3)
  • Docker (11)
  • ESXi (1)
  • Git (4)
  • Google Cloud (3)
  • Javascript (6)
  • Kubernetes (4)
  • Linux (36)
  • Mac (7)
  • Magento (4)
  • Mysql (14)
  • PHP (9)
  • Zend framework 2 (9)
  • Posted on June 5, 2014

    Using Magento cache to save custom key value data

    • You can connect your cache items to the default cache tags of magento for example BLOCK_HTML. This will ensure that your items will be removed, when magento removes block_html cache.
    
    
    //Initiate Cache class
    $cache = Mage::app()->getCache();
    
    //Get Item
    $cachedItem = $cache->load($key);
    
    //Save Item
    $cache->save($value, $key, $tags = array(), $lifeTime=null);
    
    //Remove Item
    $cache->remove($key);
    
    //Remove all items with the given tags
    $cache->clean($tags = array();