Index: wp-includes/post.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/post.php	(revision 23294)
+++ wp-includes/post.php	(revision )
@@ -2925,6 +2925,13 @@
 
 	clean_post_cache( $post_ID );
 
+	if ( function_exists( 'wp_cache_incr' ) ) {
+		wp_cache_incr( 'last_changed', 1, 'posts' );
+	} else {
+		$last_changed = wp_cache_get( 'last_changed', 'posts' );
+		wp_cache_set( 'last_changed', $last_changed + 1, 'posts' );
+	}
+
 	$post = get_post($post_ID);
 
 	if ( !empty($page_template) && 'page' == $data['post_type'] ) {
@@ -3649,16 +3656,19 @@
 	if ( array_diff( $post_status, get_post_stati() ) )
 		return $pages;
 
-	$cache = array();
+	// $args can be whatever, only use the args defined in defaults to compute the key
 	$key = md5( serialize( compact(array_keys($defaults)) ) );
-	if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
-		if ( is_array($cache) && isset( $cache[ $key ] ) && is_array( $cache[ $key ] ) ) {
+	$last_changed = wp_cache_get( 'last_changed', 'posts' );
+	if ( ! $last_changed )
+		$last_changed = wp_cache_set( 'last_changed', 1, 'posts' );
+
+	$cache_key = "get_pages:$key:$last_changed";
+	if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
-			// Convert to WP_Post instances
+		// Convert to WP_Post instances
-			$pages = array_map( 'get_post', $cache[ $key ] );
+		$pages = array_map( 'get_post', $cache );
-			$pages = apply_filters( 'get_pages', $pages, $r );
+		$pages = apply_filters('get_pages', $pages, $r);
-			return $pages;
-		}
+		return $pages;
+	}
-	}
 
 	if ( !is_array($cache) )
 		$cache = array();
@@ -3827,9 +3837,12 @@
 		}
 	}
 
-	$cache[ $key ] = $pages;
-	wp_cache_set( 'get_pages', $cache, 'posts' );
+	$page_structure = array();
+	foreach ( $pages as $page )
+		$page_structure[] = $page->ID;
 
+	wp_cache_set( $cache_key, $page_structure, 'posts' );
+
 	// Convert to WP_Post instances
 	$pages = array_map( 'get_post', $pages );
 
@@ -4662,6 +4675,13 @@
 	if ( 'page' == $post->post_type ) {
 		wp_cache_delete( 'all_page_ids', 'posts' );
 		do_action( 'clean_page_cache', $post->ID );
+	}
+
+	if ( function_exists( 'wp_cache_incr' ) ) {
+		wp_cache_incr( 'last_changed', 1, 'posts' );
+	} else {
+		$last_changed = wp_cache_get( 'last_changed', 'posts' );
+		wp_cache_set( 'last_changed', $last_changed + 1, 'posts' );
 	}
 }
 
