Magento Custom Caching with admin switch

后端 未结 1 1070
离开以前
离开以前 2020-12-29 14:14

I am writing a module that uses some custom caching mechanism and i would like for my caching to be clearable from in the admin area along with the core Magento caching.

1条回答
  •  忘掉有多难
    2020-12-29 14:41

    Magento makes this very easy for you, essentially just a few lines of code in your modules global config…

    
        
        
            
                
                    
                    Description of your modules cache
                    YOUR_MODULES_CACHE_TAGS
                
            
        
        
    
    

    The logic for checking if your cache is active or not would be along the lines of the following…

    $cacheGroup = 'namespace_module';
    $useCache = Mage::app()->useCache($cacheGroup);
    if (true === $useCache) {
        // Cache is active
    } else {
        // Cache is not active
    }
    

    0 讨论(0)
提交回复
热议问题