You are here

function sharedblocks_cache_get in Shared Blocks 7.2

Get the cached content for a block.

Parameters

string $block_name Machine name of the block:

Return value

mixed Array of block configuration data, if it was available in the cache. Otherwise, NULL is returned.

1 call to sharedblocks_cache_get()
sharedblocks_block_view in ./sharedblocks.module
Implements hook_block_view().

File

./sharedblocks.subscribe.inc, line 17
Subscribe block page callbacks for the sharedblocks module.

Code

function sharedblocks_cache_get($block_name) {
  $cache_id = 'sharedblocks:' . $block_name;
  $block_cache = cache_get($cache_id, 'cache_block');
  if (is_object($block_cache)) {

    // Only return the cached data if it has not yet expired.
    if ($block_cache->expire > REQUEST_TIME) {
      return $block_cache->data;
    }
  }

  // Either no cached data was found, or it was expired, so return NULL.
  return NULL;
}