Jan Walraven
DevOps



Categories:
  • Arduino (2)
  • CSS (3)
  • Docker (10)
  • Git (3)
  • Javascript (6)
  • Linux (31)
  • Mac (6)
  • Magento (4)
  • Mysql (13)
  • 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();