Index: src/wp-includes/post.php
===================================================================
--- src/wp-includes/post.php	(revision 37350)
+++ src/wp-includes/post.php	(working copy)
@@ -4248,6 +4248,18 @@
 
 	$post_types = esc_sql( $post_types );
 	$post_type_in_string = "'" . implode( "','", $post_types ) . "'";
+
+	$key          = $in_string . ":" . $post_type_in_string;
+	$last_changed = wp_cache_get( 'last_changed', 'posts' );
+	if ( ! $last_changed ) {
+		$last_changed = microtime();
+		wp_cache_set( 'last_changed', $last_changed, 'posts' );
+	}
+	$cache_key = "get_page_by_path:$key:$last_changed";
+	if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
+           return get_post( $cache, $output );
+	}
+
 	$sql = "
 		SELECT ID, post_name, post_parent, post_type
 		FROM $wpdb->posts
@@ -4284,6 +4296,8 @@
 			}
 		}
 	}
+    
+	wp_cache_set( $cache_key, $foundid, 'posts' ); 
 
 	if ( $foundid ) {
 		return get_post( $foundid, $output );
Index: tests/phpunit/tests/post.php
===================================================================
--- tests/phpunit/tests/post.php	(revision 37350)
+++ tests/phpunit/tests/post.php	(working copy)
@@ -565,6 +565,37 @@
 		$this->assertEquals( $other_att, get_page_by_path( 'some-other-page' ) );
 	}
 
+
+	/**
+	 * @ticket 36711
+	 */
+	function test_get_page_by_path_cache() {
+		global $wpdb;
+
+		$page       = self::factory()->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) );
+		$wpdb->update( $wpdb->posts, array( 'post_name' => 'some-page' ), array( 'ID' => $page->ID ) );
+		clean_post_cache( $page->ID );
+
+		$page = get_post( $page->ID );
+
+		$this->assertEquals( 'some-page', $page->post_name );
+		$this->assertEquals( $page, get_page_by_path( 'some-page' ) );
+
+		$wpdb->update( $wpdb->posts, array( 'post_name' => 'another-url' ), array( 'ID' => $page->ID ) );
+		clean_post_cache( $page->ID );
+
+		$page = get_post( $page->ID );
+		// Test changing url
+		$this->assertEquals( 'another-url', $page->post_name );
+		$this->assertEquals( $page, get_page_by_path( 'another-url' ) );
+
+		$num_queries = $wpdb->num_queries;
+		$this->assertEquals( $page, get_page_by_path( 'another-url' ) );
+		// Test caching
+		$this->assertEquals( $num_queries, $wpdb->num_queries ); 
+
+	}
+
 	function test_wp_publish_post() {
 		$draft_id = self::factory()->post->create( array( 'post_status' => 'draft' ) );
 
