I created a new block (a view block) but it is not available to use in other modules (like panels). If I clear all cache then it shows up.

I don't want to clear all caches but only the right one to get the same.


If you use Drush you can clearly see there are cache for block and views. Clear both these cache and you will get the required result

| improve this answer | |
  • I tried that but didn't work. Only works if I clear all caches. – chefnelone Nov 5 '15 at 13:50
  • If you have a panel, containing a block display of a view, you're doing it wrong (probably). You should be using a content-pane display of your view for use in the panel. That said, only the outer-most cache is used, so if you cache the panel, and cache the block inside the panel, and cache the view inside the block, only the panels-cache is actually used. – Shabir A. Nov 5 '15 at 14:02

Block cache is stored in the cache_block bin.

The cache ID is decided by the _block_get_cache_id() function, which you would use like so:

$block = block_load($module_name, $delta);
$cid = _block_get_cache_id($block);
cache_clear_all('cache_block', $cid);

It's worth bearing in mind that advanced modules like ctools and panels keep their own cache, so if the above doesn't work, have a look through the code for those modules and see what they use instead of the standard block cache to store data. Then clear that one instead.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.