mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
Cache API: Introduce new queries cache groups.
Give developers more control over how query caches are handled within an object caches. Now all caches that cache the result of a query, are cached in a group that is suffixed with -queries. Developers can use these groups, to add custom cache invalidation rules or to make them none persistent. Props spacedmonkey, owi, tillkruess, skithund, peterwilsoncc, flixos90, sergeybiryukov, mukesh27. Fixes #57625. git-svn-id: https://develop.svn.wordpress.org/trunk@55526 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2054,10 +2054,10 @@ function wp_get_archives( $args = '' ) {
|
||||
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit";
|
||||
$key = md5( $query );
|
||||
$key = "wp_get_archives:$key:$last_changed";
|
||||
$results = wp_cache_get( $key, 'posts' );
|
||||
$results = wp_cache_get( $key, 'post-queries' );
|
||||
if ( ! $results ) {
|
||||
$results = $wpdb->get_results( $query );
|
||||
wp_cache_set( $key, $results, 'posts' );
|
||||
wp_cache_set( $key, $results, 'post-queries' );
|
||||
}
|
||||
if ( $results ) {
|
||||
$after = $parsed_args['after'];
|
||||
@@ -2079,10 +2079,10 @@ function wp_get_archives( $args = '' ) {
|
||||
$query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit";
|
||||
$key = md5( $query );
|
||||
$key = "wp_get_archives:$key:$last_changed";
|
||||
$results = wp_cache_get( $key, 'posts' );
|
||||
$results = wp_cache_get( $key, 'post-queries' );
|
||||
if ( ! $results ) {
|
||||
$results = $wpdb->get_results( $query );
|
||||
wp_cache_set( $key, $results, 'posts' );
|
||||
wp_cache_set( $key, $results, 'post-queries' );
|
||||
}
|
||||
if ( $results ) {
|
||||
$after = $parsed_args['after'];
|
||||
@@ -2103,10 +2103,10 @@ function wp_get_archives( $args = '' ) {
|
||||
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit";
|
||||
$key = md5( $query );
|
||||
$key = "wp_get_archives:$key:$last_changed";
|
||||
$results = wp_cache_get( $key, 'posts' );
|
||||
$results = wp_cache_get( $key, 'post-queries' );
|
||||
if ( ! $results ) {
|
||||
$results = $wpdb->get_results( $query );
|
||||
wp_cache_set( $key, $results, 'posts' );
|
||||
wp_cache_set( $key, $results, 'post-queries' );
|
||||
}
|
||||
if ( $results ) {
|
||||
$after = $parsed_args['after'];
|
||||
@@ -2129,10 +2129,10 @@ function wp_get_archives( $args = '' ) {
|
||||
$query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit";
|
||||
$key = md5( $query );
|
||||
$key = "wp_get_archives:$key:$last_changed";
|
||||
$results = wp_cache_get( $key, 'posts' );
|
||||
$results = wp_cache_get( $key, 'post-queries' );
|
||||
if ( ! $results ) {
|
||||
$results = $wpdb->get_results( $query );
|
||||
wp_cache_set( $key, $results, 'posts' );
|
||||
wp_cache_set( $key, $results, 'post-queries' );
|
||||
}
|
||||
$arc_w_last = '';
|
||||
if ( $results ) {
|
||||
@@ -2168,10 +2168,10 @@ function wp_get_archives( $args = '' ) {
|
||||
$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
|
||||
$key = md5( $query );
|
||||
$key = "wp_get_archives:$key:$last_changed";
|
||||
$results = wp_cache_get( $key, 'posts' );
|
||||
$results = wp_cache_get( $key, 'post-queries' );
|
||||
if ( ! $results ) {
|
||||
$results = $wpdb->get_results( $query );
|
||||
wp_cache_set( $key, $results, 'posts' );
|
||||
wp_cache_set( $key, $results, 'post-queries' );
|
||||
}
|
||||
if ( $results ) {
|
||||
foreach ( (array) $results as $result ) {
|
||||
|
||||
Reference in New Issue
Block a user