+ /**
+ * Filter the oEmbed TTL value (time to live).
+ *
+ * @since 4.0.0
+ *
+ * @param int $time Time to live (in seconds).
+ * @param string $url The attempted embed URL.
+ * @param array $attr An array of shortcode attributes.
+ * @param int $post_ID Post ID.
+ */
+ $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID );
+
+ $cache = get_post_meta( $post_ID, $cachekey, true );
+ $cache_time = get_post_meta( $post_ID, $cachekey_time, true );
+
+ if ( ! $cache_time ) {
+ $cache_time = 0;
+ }
+
+ $cached_recently = ( time() - $cache_time ) < $ttl;
+
+ if ( $this->usecache || $cached_recently ) {
+ // Failures are cached. Serve one if we're using the cache.