Drupal 7: Making Drupal block is no-cachable:

Drupal system makes blocks is cacheable to speed render. The block cache is stored in Drupal core database block_cache table. By altering or change information of block as non-cachable. This is achieved by passing cache as "DRUPAL_NO_CACHE" in hook_block_info() for custom block and hook_block_info_alter() in existing block.


 * Implements hook_block_info().
function hook_block_info() {
  $blocks = array();
  $blocks[UNIQUE_ARRAY_KEY] = array(
    'info' => BLOCK_NAME,
    'description' => BLOCK_DESCRIPTION,
    'cache' => DRUPAL_NO_CACHE,


 * Implements hook_block_info_alter().
function hook_block_info_alter(&$blocks, $theme, $code_blocks) {
  $blocks[BLOCK_MODULE]['blockdelta']['cache'] = DRUPAL_NO_CACHE;