diff --git a/memcache.inc b/memcache.inc
index 3b5520d..cf1c8ec 100644
--- a/memcache.inc
+++ b/memcache.inc
@@ -95,8 +95,10 @@ class MemCacheDrupal implements DrupalCacheInterface {
   protected function valid($cid, $cache) {
     if ($cache) {
       $cache_tables = isset($_SESSION['cache_flush']) ? $_SESSION['cache_flush'] : NULL;
+
       // Items that have expired are invalid.
-      if (isset($cache->expire) && $cache->expire !== CACHE_PERMANENT && $cache->expire <= $_SERVER['REQUEST_TIME']) {
+      if (isset($cache->expire) && $cache->expire !== CACHE_PERMANENT
+        && $cache->expire <= $_SERVER['REQUEST_TIME']) {
         // If the memcache_stampede_protection variable is set, allow one
         // process to rebuild the cache entry while serving expired content to
         // the rest. Note that core happily returns expired cache items as valid
@@ -107,38 +109,76 @@ class MemCacheDrupal implements DrupalCacheInterface {
           // The process that acquires the lock will get a cache miss, all
           // others will get a cache hit.
           if ($this->lockInit() && $this->stampedeProtected($cid) && lock_acquire("memcache_$cid:$this->bin", variable_get('memcache_stampede_semaphore', 15))) {
+            // Cache item expired, return FALSE.
             $cache = FALSE;
           }
         }
         else {
+          // Cache item expired, return FALSE.
           $cache = FALSE;
         }
       }
+
       // Items created before the last full wildcard flush against this bin are
       // invalid.
-      elseif (!isset($cache->created) || $cache->created <= $this->cache_flush) {
+      elseif (!isset($cache->created) || !isset($cache->created_microtime)
+        // Either the created is before the cache_flush time, or the created ==
+        // cache_flush and the created microseconds is less than the
+        // cache_flush microtime.
+        || $cache->created < $this->cache_flush
+        || ($cache->created == $this->cache_flush
+          && $cache->created_microtime < $this->cache_flush_microtime)) {
+        // Cache item expired, return FALSE.
         $cache = FALSE;
       }
+
       // Items created before the last content flush on this bin i.e.
       // cache_clear_all() are invalid.
-      elseif ($cache->expire != CACHE_PERMANENT && $cache->created + $this->cache_lifetime <= $this->cache_content_flush) {
+      elseif ($cache->expire != CACHE_PERMANENT
+        // Either the created+lifetime is before the content_flush time, or
+        // the created+lifetime == content_flush and the created microseconds
+        // is less than the content_flush microtime.
+        && ($cache->created + $this->cache_lifetime < $this->cache_content_flush
+          || ($cache->created + $this->cache_lifetime == $this->cache_content_flush
+            && $cache->created_microtime < $this->cache_content_flush_microtime))) {
+        // Cache item expired, return FALSE.
         $cache = FALSE;
       }
+
       // Items cached before the cache was last flushed by the current user are
       // invalid.
-      elseif ($cache->expire != CACHE_PERMANENT && is_array($cache_tables) && isset($cache_tables[$this->bin]) && $cache_tables[$this->bin] >= $cache->created) {
+      elseif ($cache->expire != CACHE_PERMANENT && is_array($cache_tables)
+        && isset($cache_tables[$this->bin])
+        // Extract the microtime values from the cache bin counter.
+        && list($microtime, $time) = explode(' ', $cache_tables[$this->bin])
+        && !empty($microtime) && !empty($time)
+        // Either the cache table was cleared after the cache object was
+        // created (seconds), or they were created at the same time (seconds)
+        // and the cache-clear's microseconds are higher than the cache.
+        && ($time > $cache->created
+          || ($time == $cache->created
+            && $microtime > $cache->created_microtime))) {
         // Cache item expired, return FALSE.
         $cache = FALSE;
       }
+
       // Temporary items created before the cache was last flushed by
       // cache_clear_all(NULL, $bin) are invalid.
-      elseif (!empty($cache->temporary) && $cache->created + $this->cache_lifetime <= $this->cache_temporary_flush) {
+      elseif (!empty($cache->temporary)
+        // Either the created+lifetime is before the temporary_flush time, or
+        // the created+lifetime == temporary_flush and the created microseconds
+        // is less than the temporary_flush microtime.
+        && ($cache->created + $this->cache_lifetime < $this->cache_temporary_flush
+          || ($cache->created + $this->cache_lifetime == $this->cache_temporary_flush
+            && $cache->created_microtime < $this->cache_temporary_flush_microtime))) {
         // CACHE_TEMPORARY item expired, return FALSE.
         $cache = FALSE;
       }
+
       // Finally, check for wildcard clears against this cid.
       else {
         if (!$this->wildcardValid($cid, $cache)) {
+          // Cache item expired, return FALSE.
           $cache = FALSE;
         }
       }
@@ -176,14 +216,14 @@ class MemCacheDrupal implements DrupalCacheInterface {
    * Implements DrupalCacheInterface::set().
    */
   public function set($cid, $data, $expire = CACHE_PERMANENT) {
-    $created_microtime = round(microtime(TRUE), 3);
+    list($microtime, $time) = explode(' ', microtime());
 
     // Create new cache object.
     $cache = new stdClass();
     $cache->cid = $cid;
     $cache->data = is_object($data) ? clone $data : $data;
-    $cache->created = REQUEST_TIME;
-    $cache->created_microtime = $created_microtime;
+    $cache->created = $time;
+    $cache->created_microtime = $microtime;
     // Record the previous number of wildcard flushes affecting our cid.
     $cache->flushes = $this->wildcardFlushes($cid);
     if ($expire == CACHE_TEMPORARY) {
@@ -243,8 +283,11 @@ class MemCacheDrupal implements DrupalCacheInterface {
       // retrieving data from this bin, we will compare the cache creation
       // time minus the cache_flush time to the cache_lifetime to determine
       // whether or not the cached item is still valid.
-      $this->cache_content_flush = time();
+      list($microtime, $time) = explode(' ', microtime());
+      $this->cache_content_flush = $time;
+      $this->cache_content_flush_microtime = $microtime;
       $this->variable_set('cache_content_flush_' . $this->bin, $this->cache_content_flush);
+      $this->variable_set('cache_content_flush_microtime_' . $this->bin, $this->cache_content_flush_microtime);
       if (variable_get('cache_lifetime', 0)) {
         // We store the time in the current user's session. We then simulate
         // that the cache was flushed for this user by not returning cached
@@ -255,8 +298,8 @@ class MemCacheDrupal implements DrupalCacheInterface {
         else {
           $cache_bins = array();
         }
-        // Use time() rather than request time here for correctness.
-        $cache_tables[$this->bin] = $this->cache_content_flush;
+        // Use microtime() rather than request time here for correctness.
+        $cache_tables[$this->bin] = $this->cache_content_flush . ' ' . $this->cache_content_flush_microtime;
         $_SESSION['cache_flush'] = $cache_tables;
       }
     }
@@ -269,8 +312,11 @@ class MemCacheDrupal implements DrupalCacheInterface {
       if (!isset($cid)) {
         // Update the timestamp of the last CACHE_TEMPORARY clear. All
         // temporary cache items created before this will be invalidated.
-        $this->cache_temporary_flush = time();
+        list($microtime, $time) = explode(' ', microtime());
+        $this->cache_temporary_flush = $time;
+        $this->cache_temporary_flush_microtime = $microtime;
         $this->variable_set("cache_temporary_flush_$this->bin", $this->cache_temporary_flush);
+        $this->variable_set("cache_temporary_flush_microtime_$this->bin", $this->cache_temporary_flush_microtime);
         // Return early here as we do not want to register a wildcard flush.
         return;
       }
@@ -282,8 +328,11 @@ class MemCacheDrupal implements DrupalCacheInterface {
         // retrieving data from this bin, we will compare the cache creation
         // time minus the cache_flush time to the cache_lifetime to determine
         // whether or not the cached item is still valid.
-        $this->cache_flush = time();
+        list($microtime, $time) = explode(' ', microtime());
+        $this->cache_flush = $time;
+        $this->cache_flush_microtime = $microtime;
         $this->variable_set("cache_flush_$this->bin", $this->cache_flush);
+        $this->variable_set("cache_flush_microtime_$this->bin", $this->cache_flush_microtime);
         $this->flushed = min($this->cache_flush, time() - $this->cache_lifetime);
 
         if ($this->cache_lifetime) {
@@ -297,7 +346,8 @@ class MemCacheDrupal implements DrupalCacheInterface {
           else {
             $cache_bins = array();
           }
-          $cache_bins[$this->bin] = $this->cache_flush;
+          $cache_tables[$this->bin] = $this->cache_content_flush . ' ' . $this->cache_content_flush_microtime;
+          $cache_bins[$this->bin] = $this->cache_flush . ' ' . $this->cache_flush_microtime;
           $_SESSION['cache_flush'] = $cache_bins;
         }
       }
@@ -423,9 +473,12 @@ class MemCacheDrupal implements DrupalCacheInterface {
         // it ensures the minimum possible number of wildcards are requested
         // along with cache consistency.
         if ($length < $key_length) {
+          list($microtime, $time) = explode(' ', microtime());
           $this->wildcard_flushes[$this->bin] = array();
-          $this->variable_set("cache_flush_$this->bin", time());
-          $this->cache_flush = time();
+          $this->variable_set("cache_flush_$this->bin", $time);
+          $this->variable_set("cache_flush_microtime_$this->bin", $microtime);
+          $this->cache_flush = $time;
+          $this->cache_flush_microtime = $microtime;
         }
         $key = substr($cid, 0, $key_length);
         $this->wildcard_flushes[$this->bin][$key][$length] = $_SERVER['REQUEST_TIME'];
@@ -569,8 +622,11 @@ class MemCacheDrupal implements DrupalCacheInterface {
     $this->invalidate = variable_get('memcache_wildcard_invalidate', MEMCACHE_WILDCARD_INVALIDATE);
     $this->cache_lifetime = variable_get('cache_lifetime', 0);
     $this->cache_flush = variable_get('cache_flush_' . $this->bin);
+    $this->cache_flush_microtime = variable_get('cache_flush_microtime_' . $this->bin);
     $this->cache_content_flush = variable_get('cache_content_flush_' . $this->bin, 0);
+    $this->cache_content_flush_microtime = variable_get('cache_content_flush_microtime_' . $this->bin, 0);
     $this->cache_temporary_flush = variable_get('cache_temporary_flush_' . $this->bin, 0);
+    $this->cache_temporary_flush_microtime = variable_get('cache_temporary_flush_microtime_' . $this->bin, 0);
     $this->flushed = min($this->cache_flush, REQUEST_TIME - $this->cache_lifetime);
   }
 
diff --git a/tests/memcache-lock.test b/tests/memcache-lock.test
index 29e995c..b60bd24 100644
--- a/tests/memcache-lock.test
+++ b/tests/memcache-lock.test
@@ -20,7 +20,7 @@ class MemcacheLockFunctionalTest extends MemcacheTestCase {
    * @see MemcacheTestCase::setUp()
    */
   public function setUp() {
-    parent::setUp('memcache_test');
+    parent::setUp('memcache_test', 'locale');
   }
 
   /**
@@ -32,42 +32,46 @@ class MemcacheLockFunctionalTest extends MemcacheTestCase {
     $this->assertTrue(dmemcache_get($this->default_cid, 'semaphore'), t('Memcache locking is configured correctly.'));
     lock_release($this->default_cid);
 
-    // Nasty hack. There are two processes involved here - the process
-    // calling the test itself, that calls lock_acquire() directly. And the
-    // 'child' process that is requested over http by drupalGet().
-    // In dmemcache.inc, we look for simpletest installs, to force a
-    // simpletest prefix as part of the memcache key - this avoids the
-    // actual Drupal site install being corrupted by entries from the tested
-    // site. However, the child install apparently does not set the simpletest
-    // global, so when making requests to that site, we pass the simpletest ID
-    // as part of the URL, and mess around with the globals on that side.
+    // Nasty hack. There are two processes involved here - the process calling
+    // the test itself, that calls lock_acquire() directly, and the 'child'
+    // process that is requested over http by drupalGet(). In dmemcache.inc, we
+    // look for simpletest installs, to force a simpletest prefix as part of
+    // the memcache key - this avoids the actual Drupal site install being
+    // corrupted by entries from the tested site. However, the child install
+    // apparently does not set the simpletest global, so when making requests
+    // to that site, we pass the simpletest ID as part of the URL, and mess
+    // around with the globals on that side.
     $test_run_id = $GLOBALS['drupal_test_info']['test_run_id'];
     $lock_acquired = 'TRUE: Lock successfully acquired in memcache_test_lock_acquire()';
     $lock_not_acquired = 'FALSE: Lock not acquired in memcache_test_lock_acquire()';
     $this->assertTrue(lock_acquire('memcache_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock'));
     $this->assertTrue(lock_acquire('memcache_test_lock_acquire'), t('Lock extended by this request.'), t('Lock'));
-    lock_release('memcache_test_lock_acquire');
 
     // Cause another request to acquire the lock.
+    lock_release('memcache_test_lock_acquire');
     $this->drupalGet('memcache-test/lock-acquire' . "/$test_run_id");
     $this->assertText($lock_acquired, t('Lock acquired by the other request.'), t('Lock'));
+
     // The other request has finished, thus it should have released its lock.
     $this->assertTrue(lock_acquire('memcache_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock'));
+
     // This request holds the lock, so the other request cannot acquire it.
     $this->drupalGet('memcache-test/lock-acquire' . "/$test_run_id");
     $this->assertText($lock_not_acquired, t('Lock not acquired by the other request.'), t('Lock'));
-    lock_release('memcache_test_lock_acquire');
 
     // Try a very short timeout and lock breaking.
+    lock_release('memcache_test_lock_acquire');
     $this->assertTrue(lock_acquire('memcache_test_lock_acquire', 1), t('Lock acquired by this request.'), t('Lock'));
-    sleep(2);
+
     // The other request should break our lock.
+    sleep(2);
     $this->drupalGet('memcache-test/lock-acquire' . "/$test_run_id");
     $this->assertText($lock_acquired, t('Lock acquired by the other request, breaking our lock.'), t('Lock'));
+
     // We cannot renew it, since the other thread took it.
-    // @todo: this assertion currently fails - the lock_acquire() call returns
-    // true. For now, commented out the assertion, uncomment when attempting to
-    // fix.
+    // @todo This assertion currently fails - the lock_acquire() call returns
+    //   TRUE. For now, commented out the assertion, uncomment when attempting
+    //   to fix.
     // $this->assertFalse(lock_acquire('memcache_test_lock_acquire'), t('Lock cannot be extended by this request.'), t('Lock'));
 
     // Check the shut-down function.
diff --git a/tests/memcache-session.test b/tests/memcache-session.test
index 77528b1..53c5d3f 100644
--- a/tests/memcache-session.test
+++ b/tests/memcache-session.test
@@ -176,7 +176,8 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
     $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
     $this->assertFalse($this->drupalGetHeader('Set-Cookie'), t('New session was not started.'));
 
-    // Verify that no session is created if drupal_save_session(FALSE) is called.
+    // Verify that no session is created if drupal_save_session(FALSE) is
+    // called.
     $this->drupalGet('session-test/set-message-but-dont-save');
     $this->assertSessionCookie(FALSE);
     $this->assertSessionEmpty(TRUE);
diff --git a/tests/memcache.test b/tests/memcache.test
index ee65bd1..599b3b3 100644
--- a/tests/memcache.test
+++ b/tests/memcache.test
@@ -35,6 +35,7 @@ class MemcacheTestCase extends DrupalWebTestCase {
     // Setup our own memcache variables here. We can't use variable_set() yet.
     if ($this->default_bin) {
       $conf["cache_flush_$this->default_bin"] = 0;
+      $conf["cache_flush_microtime_$this->default_bin"] = 0;
       $conf["cache_class_$this->default_bin"] = 'MemcacheDrupal';
     }
 
@@ -132,6 +133,7 @@ class MemcacheTestCase extends DrupalWebTestCase {
     if ($this->default_bin) {
       // Save our memcache variables.
       variable_set("cache_flush_$this->default_bin", 0);
+      variable_set("cache_flush_microtime_$this->default_bin", 0);
       variable_set("cache_class_$this->default_bin", 'MemcacheDrupal');
     }
 
@@ -260,7 +262,7 @@ class MemCacheSavingCase extends MemcacheTestCase {
    * @see MemcacheTestCase::setUp()
    */
   public function setUp() {
-    parent::setUp();
+    parent::setUp('locale');
   }
 
   /**
@@ -431,8 +433,7 @@ class MemCacheClearCase extends MemcacheTestCase {
    * @see MemcacheTestCase::setUp()
    */
   public function setUp() {
-
-    parent::setUp('memcache_test');
+    parent::setUp('memcache_test', 'locale');
     $this->default_value = $this->randomName(10);
   }
 
@@ -474,12 +475,12 @@ class MemCacheClearCase extends MemcacheTestCase {
     cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
     cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
     $this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
-                      && $this->checkCacheExists('test_cid_clear2', $this->default_value),
-                      t('Two caches were created for checking cid "*" with wildcard true.'));
+      && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+      t('Two caches were created for checking cid "*" with wildcard true.'));
     cache_clear_all('*', $this->default_bin, TRUE);
     $this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
-                      || $this->checkCacheExists('test_cid_clear2', $this->default_value),
-                      t('Two caches removed after clearing cid "*" with wildcard true.'));
+      || $this->checkCacheExists('test_cid_clear2', $this->default_value),
+      t('Two caches removed after clearing cid "*" with wildcard true.'));
   }
 
   /**
@@ -498,8 +499,10 @@ class MemCacheClearCase extends MemcacheTestCase {
 
     // Clear the page and block caches.
     cache_clear_all(MEMCACHE_CONTENT_CLEAR, $this->default_bin);
+
     // Since the cache was cleared within the current session, cache_get()
     // should return false.
+    // FAILS.
     $this->assertFalse($this->checkCacheExists('test_cid', $this->default_value), 'Cache item was cleared successfully.');
 
     // However permament items should stay in place.
@@ -510,17 +513,20 @@ class MemCacheClearCase extends MemcacheTestCase {
     unset($_SESSION['cache_flush']);
     $this->assertTrue($this->checkCacheExists('test_cid', $this->default_value), 'Cache item is still returned due to minimum cache lifetime.');
 
-    // Set a much shorter cache lifetime.
+    // Set a much shorter cache lifetime and run the same tests again.
     variable_set('cache_content_flush_' . $this->default_bin, 0);
+    variable_set('cache_content_flush_microtime_' . $this->default_bin, 0);
     variable_set('cache_lifetime', 1);
     cache_set('test_cid_1', $this->default_value, $this->default_bin, time() + 6000);
     $this->assertTrue($this->checkCacheExists('test_cid', $this->default_value), 'Cache item was created successfully.');
     sleep(2);
     cache_clear_all(MEMCACHE_CONTENT_CLEAR, $this->default_bin);
+    // FAILS.
     $this->assertFalse($this->checkCacheExists('test_cid', $this->default_value), 'Cache item is not returned once minimum cache lifetime has expired.');
 
     // Reset the cache clear variables.
     variable_set('cache_content_flush_' . $this->default_bin, 0);
+    variable_set('cache_content_flush_microtime_' . $this->default_bin, 0);
     variable_set('cache_lifetime', 6000);
     $this->resetVariables();
     sleep(1);
@@ -589,22 +595,21 @@ class MemCacheClearCase extends MemcacheTestCase {
     cache_set('test_cid_clear_future', $this->default_value, $this->default_bin, time() + 3600);
 
     $this->assertTrue($this->checkCacheExists('test_cid_clear_temporary', $this->default_value)
-                      && $this->checkCacheExists('test_cid_clear_permanent', $this->default_value)
-                      && $this->checkCacheExists('test_cid_clear_future', $this->default_value),
-                      t('Three cache items were created for checking cache expiry.'));
+      && $this->checkCacheExists('test_cid_clear_permanent', $this->default_value)
+      && $this->checkCacheExists('test_cid_clear_future', $this->default_value),
+      t('Three cache items were created for checking cache expiry.'));
 
     // This should clear only expirable items (CACHE_TEMPORARY).
     cache_clear_all(NULL, $this->default_bin, TRUE);
 
     $this->assertFalse($this->checkCacheExists('test_cid_clear_temporary', $this->default_value),
-                      t('Temporary cache item was removed after clearing cid NULL.'));
+      t('Temporary cache item was removed after clearing cid NULL.'));
     $this->assertTrue($this->checkCacheExists('test_cid_clear_permanent', $this->default_value),
-                      t('Permanent cache item was not removed after clearing cid NULL.'));
+      t('Permanent cache item was not removed after clearing cid NULL.'));
     $this->assertTrue($this->checkCacheExists('test_cid_clear_future', $this->default_value),
-                      t('Future cache item was not removed after clearing cid NULL.'));
+      t('Future cache item was not removed after clearing cid NULL.'));
   }
 
-
   /**
    * Test clearing using a cid.
    */
@@ -619,12 +624,12 @@ class MemCacheClearCase extends MemcacheTestCase {
     cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
     cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
     $this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
-                      && $this->checkCacheExists('test_cid_clear2', $this->default_value),
-                      t('Two caches were created for checking cid "*" with wildcard false.'));
+      && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+      t('Two caches were created for checking cid "*" with wildcard false.'));
     cache_clear_all('*', $this->default_bin);
     $this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
-                      && $this->checkCacheExists('test_cid_clear2', $this->default_value),
-                      t('Two caches still exists after clearing cid "*" with wildcard false.'));
+      && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+      t('Two caches still exists after clearing cid "*" with wildcard false.'));
   }
 
   /**
@@ -635,23 +640,26 @@ class MemCacheClearCase extends MemcacheTestCase {
     cache_set('test_cid_clear:1', $this->default_value, $this->default_bin);
     cache_set('test_cid_clear:2', $this->default_value, $this->default_bin);
     $this->assertTrue($this->checkCacheExists('test_cid_clear:1', $this->default_value)
-                      && $this->checkCacheExists('test_cid_clear:2', $this->default_value),
-                      t('Two caches were created for checking cid substring with wildcard true.'));
+      && $this->checkCacheExists('test_cid_clear:2', $this->default_value),
+      t('Two caches were created for checking cid substring with wildcard true.'));
     cache_clear_all('test_cid_clear:', $this->default_bin, TRUE);
     $this->assertFalse($this->checkCacheExists('test_cid_clear:1', $this->default_value)
-                      || $this->checkCacheExists('test_cid_clear:2', $this->default_value),
-                      t('Two caches removed after clearing cid substring with wildcard true.'));
+      || $this->checkCacheExists('test_cid_clear:2', $this->default_value),
+      t('Two caches removed after clearing cid substring with wildcard true.'));
+
     // Test for the case where a wildcard object disappears, for example a
     // partial memcache restart or eviction.
     cache_set('test_cid_clear:1', $this->default_value, $this->default_bin);
     $this->assertTrue($this->checkCacheExists('test_cid_clear:1', $this->default_value), 'The cache was created successfully.');
     cache_clear_all('test_', $this->default_bin, TRUE);
     $this->assertFalse($this->checkCacheExists('test_cid_clear:1', $this->default_value), 'The cache was cleared successfully.');
+
     // Delete the wildcard manually to simulate an eviction.
     $wildcard = '.wildcard-test_cid_clear:';
     dmemcache_delete($wildcard, $this->default_bin);
+
     // Reset the memcache_wildcards() static cache.
-    // @todo: this is a class object in D7.
+    // @todo This is a class object in D7.
     // memcache_wildcards(FALSE, FALSE, FALSE, TRUE);
     $this->assertFalse($this->checkCacheExists('test_cid_clear:1', $this->default_value), 'The cache was cleared successfully.');
   }
@@ -660,7 +668,6 @@ class MemCacheClearCase extends MemcacheTestCase {
    * Test wildcard flushing on separate pages to ensure no static cache is used.
    */
   public function testClearWildcardOnSeparatePages() {
-
     $random_wildcard = $this->randomName(2) . ':' . $this->randomName(3);
     $random_key = $random_wildcard . ':' . $this->randomName(4) . ':' . $this->randomName(2);
     $random_value = $this->randomName();
@@ -692,8 +699,13 @@ class MemCacheClearCase extends MemcacheTestCase {
     $this->assertEqual($random_key, $data['cid'], 'Cache keys match.');
     $this->assertEqual($random_value, $data['data'], 'Cache values match.');
 
-    $this->drupalGet('memcache-test/wildcard-clear/' . $random_wildcard);
+    // Clear all caches beginning with this string and verify that the callback
+    // returns the same string (though JSON encoded) to confirm it worked.
+    $return = $this->drupalGet('memcache-test/wildcard-clear/' . $random_wildcard);
+    $return = json_decode($return);
+    $this->assertEqual($return, $random_wildcard, 'Cache wildcard flush request successful.');
 
+    // FAILS.
     $data = $this->drupalGetAJAX('memcache-test/get/' . $random_key);
     $this->assertFalse($data, 'Cache was properly flushed.');
   }
@@ -721,9 +733,11 @@ class MemCacheStampedeProtection extends MemcacheTestCase {
 
     // Setup a new test bin, to be able to override the used class.
     $conf['cache_flush_test_bin'] = 0;
+    $conf['cache_flush_microtime_test_bin'] = 0;
     $conf['cache_class_test_bin'] = 'MockMemCacheDrupal';
 
     $conf['cache_flush_test_bin_2'] = 0;
+    $conf['cache_flush_microtime_test_bin_2'] = 0;
     $conf['cache_class_test_bin_2'] = 'MockMemCacheDrupal';
 
     // Setup stampede protection.
@@ -794,7 +808,7 @@ class MemCacheRealWorldCase extends MemcacheTestCase {
    * @see MemcacheTestCase::setUp()
    */
   public function setUp() {
-    parent::setUp('menu');
+    parent::setUp('menu', 'locale');
   }
 
   /**
@@ -872,6 +886,7 @@ class MemCacheRealWorldCase extends MemcacheTestCase {
     // Add menu link.
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertResponse(200);
+
     // Unlike most other modules, there is no confirmation message displayed.
     $this->assertText($title, 'Menu link was added');
 
@@ -912,6 +927,7 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
    */
   public function testBootstrapStatistics() {
     global $_dmemcache_stats;
+
     // Expected statistics for cache_set() and cache_get().
     $test_full_key = dmemcache_key($this->default_cid, $this->default_bin);
 
@@ -928,7 +944,9 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
     variable_set('show_memcache_statistics', TRUE);
     drupal_static_reset('dmemcache_stats_init');
 
+    // Load the frotn page.
     $this->drupalGet('<front>');
+
     // Check that statistics are not displayed for anonymous users.
     $this->assertNoRaw('<div id="memcache-devel">', 'Statistics not present.');
 
@@ -944,7 +962,9 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
     $account = $this->drupalCreateUser(array('access memcache statistics'));
     $this->drupalLogin($account);
 
+    // Load the front page again.
     $this->drupalGet('<front>');
+
     // Check that bootstrap statistics are visible.
     foreach ($cache_bootstrap_cids as $stat) {
       $key = $GLOBALS['drupal_test_info']['test_run_id'] . 'cache_bootstrap-' . $stat;
@@ -956,7 +976,9 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
       _cache_get_object('cache_bootstrap')->clear($stat);
     }
 
+    // Load the front page again.
     $this->drupalGet('<front>');
+
     // Check that early bootstrap statistics are still visible and are being
     // set too, after they were removed.
     foreach ($cache_bootstrap_cids as $stat) {
@@ -967,6 +989,7 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
 
     // Clear the internal statistics store.
     $_dmemcache_stats = array('all' => array(), 'ops' => array());
+
     // Check that cache_set() statistics are being recorded.
     cache_set($this->default_cid, $this->default_value, $this->default_bin);
     $this->assertEqual($_dmemcache_stats['all'][0][1], 'set', 'Set action recorded.');
@@ -975,6 +998,7 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
 
     // Clear the internal statistics store.
     $_dmemcache_stats = array('all' => array(), 'ops' => array());
+
     // Check that cache_get() statistics are being recorded.
     cache_get($this->default_cid, $this->default_bin);
     $this->assertEqual($_dmemcache_stats['all'][0][1], 'get', 'Get action recorded.');
@@ -985,19 +1009,23 @@ class MemCacheStatisticsTestCase extends MemcacheTestCase {
     variable_set('show_memcache_statistics', FALSE);
     drupal_static_reset('dmemcache_stats_init');
 
+    // Load the front page again.
     $this->drupalGet('<front>');
+
     // Check that statistics are not recorded when the user has access, but
     // statistics are disabled.
     $this->assertNoRaw('<div id="memcache-devel">', 'Statistics not present.');
 
     // Clear the internal statistics store.
     $_dmemcache_stats = array('all' => array(), 'ops' => array());
+
     // Confirm that statistics are not recorded for get()'s when disabled.
     cache_set($this->default_cid, $this->default_value, $this->default_bin);
     $this->assertEqual($_dmemcache_stats, array('all' => array(), 'ops' => array()));
 
     // Clear the internal statistics store.
     $_dmemcache_stats = array('all' => array(), 'ops' => array());
+
     // Confirm that statistics are not recorded for set()'s when disabled.
     cache_get($this->default_cid, $this->default_bin);
     $this->assertEqual($_dmemcache_stats, array('all' => array(), 'ops' => array()));
diff --git a/tests/memcache_test.module b/tests/memcache_test.module
index 45c43a2..4584ac2 100644
--- a/tests/memcache_test.module
+++ b/tests/memcache_test.module
@@ -116,7 +116,6 @@ function memcache_test_wildcard_flush($key) {
  */
 function memcache_test_clear($key) {
   cache_clear_all($key, 'MemcacheDrupal');
-
   drupal_json_output($key);
 }
 
