Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 23700)
+++ wp-includes/media.php	(working copy)
@@ -1024,12 +1024,14 @@
  *
  * @param string $url The URL that should be embedded.
  * @param array $args Additional arguments and parameters.
+ * @param bool $use_cache Use a cached value if available.
+ * @param int $post_id The post ID we're embedding into, or null
  * @return bool|string False on failure or the embed HTML on success.
  */
-function wp_oembed_get( $url, $args = '' ) {
+function wp_oembed_get( $url, $args = '', $use_cache = true, $post_id = null ) {
 	require_once( ABSPATH . WPINC . '/class-oembed.php' );
 	$oembed = _wp_oembed_get_object();
-	return $oembed->get_html( $url, $args );
+	return $oembed->get_html( $url, $args, $use_cache, $post_id );
 }
 
 /**
Index: wp-includes/class-oembed.php
===================================================================
--- wp-includes/class-oembed.php	(revision 23700)
+++ wp-includes/class-oembed.php	(working copy)
@@ -66,9 +66,26 @@
 	 *
 	 * @param string $url The URL to the content that should be attempted to be embedded.
 	 * @param array $args Optional arguments. Usually passed from a shortcode.
+     * @param bool $use_cache Use a cached value if available.
+     * @param int $post_ID The post ID we're embedding into - or null
 	 * @return bool|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
 	 */
-	function get_html( $url, $args = '' ) {
+	function get_html( $url, $args = '', $use_cache = true, $post_ID = null ) {
+
+        // Check for a cached result (stored in the post meta)
+        $cachekey = '_oembed_' . md5( $url . serialize( $attr ) );
+        $expirykey = '_oemexp_' . md5( $url . serialize( $attr ) );
+
+        if ( $use_cache && ! empty( $post_ID ) ) {
+
+            $cache = get_post_meta( $post_ID, $cachekey, true );
+            $cache_expiry = get_post_meta( $post_ID, $expirykey, true );
+
+            if ( ! empty( $cache ) && ! empty( $cache_expiry ) && $cache_expiry > time() )
+                return $cache;
+
+        }
+
 		$provider = false;
 
 		if ( !isset($args['discover']) )
@@ -92,10 +109,25 @@
 		if ( !$provider && $args['discover'] )
 			$provider = $this->discover( $url );
 
-		if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
-			return false;
+		if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) ) {
 
-		return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
+            // Cache failures.
+            $return = '{{unknown}}';
+            $expiry_time = time() + 12 * HOUR_IN_SECONDS ;
+
+        } else {
+
+            $return = apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
+            $cache_age = ! empty ( $data->cache_age ) ? (int) $data->cache_age : 30 * DAY_IN_SECONDS;
+            $expiry_time = time() + $cache_age;
+        }
+
+        if ( ! empty( $post_ID ) ) {
+            update_post_meta( $post_ID, $cachekey, $return);
+            update_post_meta( $post_ID, $expirykey, $expiry_time);
+        }
+
+		return $return;
 	}
 
 	/**
Index: wp-includes/class-wp-embed.php
===================================================================
--- wp-includes/class-wp-embed.php	(revision 23700)
+++ wp-includes/class-wp-embed.php	(working copy)
@@ -25,8 +25,8 @@
 		// Attempts to embed all URLs in a post
 		add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
 
-		// When a post is saved, invalidate the oEmbed cache
-		add_action( 'pre_post_update', array( $this, 'delete_oembed_caches' ) );
+        // When a post is saved, invalidate the oEmbed cache
+        add_action( 'pre_post_update', array( $this, 'delete_oembed_caches' ) );
 
 		// After a post is saved, cache oEmbed items via AJAX
 		add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) );
@@ -165,30 +165,18 @@
 		// Unknown URL format. Let oEmbed have a go.
 		if ( $post_ID ) {
 
-			// Check for a cached result (stored in the post meta)
-			$cachekey = '_oembed_' . md5( $url . serialize( $attr ) );
-			if ( $this->usecache ) {
-				$cache = get_post_meta( $post_ID, $cachekey, true );
-
-				// Failures are cached
-				if ( '{{unknown}}' === $cache )
-					return $this->maybe_make_link( $url );
-
-				if ( ! empty( $cache ) )
-					return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
-			}
-
 			// Use oEmbed to get the HTML
 			$attr['discover'] = ( apply_filters('embed_oembed_discover', false) && author_can( $post_ID, 'unfiltered_html' ) );
-			$html = wp_oembed_get( $url, $attr );
+			$html = wp_oembed_get( $url, $attr, $this->usecache, $post_ID );
 
-			// Cache the result
-			$cache = ( $html ) ? $html : '{{unknown}}';
-			update_post_meta( $post_ID, $cachekey, $cache );
+			// If there was a result, return it
+			if ( $html ) {
+                // Failures
+                if ( '{{unknown}}' === $html )
+                    return $this->maybe_make_link( $url );
 
-			// If there was a result, return it
-			if ( $html )
 				return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
+            }
 		}
 
 		// Still unknown
@@ -196,22 +184,24 @@
 	}
 
 	/**
-	 * Delete all oEmbed caches.
-	 *
-	 * @param int $post_ID Post ID to delete the caches for.
-	 */
-	function delete_oembed_caches( $post_ID ) {
-		$post_metas = get_post_custom_keys( $post_ID );
-		if ( empty($post_metas) )
-			return;
+     * Delete all oEmbed caches.
+     *
+     * @param int $post_ID Post ID to delete the caches for.
+     */
+    function delete_oembed_caches( $post_ID ) {
+        $post_metas = get_post_custom_keys( $post_ID );
+        if ( empty($post_metas) )
+            return;
 
-		foreach( $post_metas as $post_meta_key ) {
-			if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) )
-				delete_post_meta( $post_ID, $post_meta_key );
-		}
-	}
+        foreach( $post_metas as $post_meta_key ) {
+            if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) ||
+                 '_oemexp_' == substr( $post_meta_key, 0, 9 ) )
+                delete_post_meta( $post_ID, $post_meta_key );
+        }
+    }
 
-	/**
+    /**
+     *
 	 * Triggers a caching of all oEmbed results.
 	 *
 	 * @param int $post_ID Post ID to do the caching for.
