Clean everything (use either):
Mage::app()->getCacheInstance()->flush();
Mage::app()->getCache()->clean();
Clean specific types:
Mage::app()->getCacheInstance()->cleanType('config');
Mage::app()->getCacheInstance()->cleanType('layout');
Mage::app()->getCacheInstance()->cleanType('block_html');
Mage::app()->getCacheInstance()->cleanType('translate');
Mage::app()->getCacheInstance()->cleanType('collections');
Mage::app()->getCacheInstance()->cleanType('eav');
Mage::app()->getCacheInstance()->cleanType('config_api');
Enterprise_PageCache_Model_Cache::getCacheInstance()->cleanType('full_page');
Get all declared cache types:
Mage::app()->getCacheInstance()->getTypes();
Cache Types
Each cache has it's own type id, which is a Magento concept to aid management of
each type of cache, basically you would use the type id to clear by that type.
Each type corresponds to a tag or a set of tags which will be cleaned when you
clean that type. To find out the info for all the currently declared types use
the "Get all declared cache types" snippet above and var_dump()
it.
All cache types are stored in config, in the path global/cache/types
, so you
could also use something like the
Magento Debug Toolbar
Show archive.org snapshot
to
inspect the config stored at that path.
Configuration
Type ID: config
Tags: CONFIG
Layouts
Type ID: layout
Tags: LAYOUT_GENERAL_CACHE_TAG
Blocks HTML output
Type ID: block_html
Tags: BLOCK_HTML
Translations
Type ID: translate
Tags: TRANSLATE
Collections Data
Type ID: collections
Tags: COLLECTION_DATA
EAV types and attributes
Type ID: eav
Tags: EAV
Web Services Configuration
Type ID: config_api
Tags: CONFIG_API
(Full) Page Cache
Type ID: full_page
Tags: FPC
Note - full page cache is normally kept in a seperate cache backend, so you
should use it's own cache manager to reliably clear it