You are here

function flush_page_cache_test_object_cache_disabled in Flush page cache 6

Same name and namespace in other branches
  1. 7 flush_page_cache.module \flush_page_cache_test_object_cache_disabled()

Test that the object cache is being correctly disabled and flushed.

1 call to flush_page_cache_test_object_cache_disabled()
flush_page_cache_footer in ./flush_page_cache.module
Implementation of hook_footer().

File

./flush_page_cache.module, line 193
Easing the pain when you need to flush...Drupal's cache.

Code

function flush_page_cache_test_object_cache_disabled() {
  $cid = 'flush-page-cache-test';
  $uuid = uniqid();

  // Purge any old test $cid;
  cache_clear_all($cid, 'cache');

  // Attempt so set $cid cache which will work.
  cache_set($cid, $uuid, 'cache');

  // If page object cache is correctly disabled this will return NULL and not the uuid.
  $cache = cache_get($cid);
  $is_disabled = empty($cache) || $cache->data != $uuid ? TRUE : FALSE;

  // Cleanup test $cid.
  cache_clear_all($cid, 'cache');
  return $is_disabled;
}