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
Block cache is stored in the
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.