Index: wp-includes/cache.php
--- wp-includes/cache.php Base (BASE)
+++ wp-includes/cache.php Locally Modified (Based On LOCAL)
@@ -216,6 +216,35 @@
 }
 
 /**
+ * Attempt to retrieve a value from the cache. If it is not already set, the
+ * callback function is attempted. If that does not return a result, the
+ * $default is used. The $result is then set in the cache, and returned.
+ *
+ * This is a helper, and does not have a partner method in WP_Object_Cache
+ * 
+ * @since 3.4
+ * @param int|string $key What to call the contents in the cache
+ * @param mixed $default The default contents to cache
+ * @param string Optional $callback Function name to call if cache not set
+ * @param string Optional $group Where to group the cache contents
+ * @param int Optional $expire When to expire the cache contents
+ * @return mixed The cache contents on cache hit, the callback or default on cache miss
+ */
+function wp_cache_attempt( $key, $default, $callback = '', $group = '', $expire = 0 ) {
+	$result = wp_cache_get( $key, $group );
+	if ( ! $result ) {
+		if ( $callback ) {
+			$result = call_user_func( $callback );
+		}
+		if ( ! $result ) {
+			$result = $default;
+		}
+		wp_cache_set( $key, $result, $group, $expire );
+	}
+	return $result;
+}
+
+/**
  * WordPress Object Cache
  *
  * The WordPress Object Cache is used to save on trips to the database. The
