CodeExplorer generate_cache_key example
$this->terms =
apply_filters_ref_array( 'terms_pre_query', array
( $this->terms, &
$this ) );
if ( null !==
$this->terms
) { return $this->terms;
} $cache_key =
$this->
generate_cache_key( $args,
$this->request
);
$cache =
wp_cache_get( $cache_key, 'term-queries'
);
if ( false !==
$cache ) { if ( 'ids' ===
$_fields ) { $cache =
array_map( 'intval',
$cache );
} elseif ( 'count' !==
$_fields ) { if ( ( 'all_with_object_id' ===
$_fields && !
empty( $args['object_ids'
] ) ) || ( 'all' ===
$_fields &&
$args['pad_counts'
] ) ) { $term_ids =
wp_list_pluck( $cache, 'term_id'
);
} else { $this->results =
apply_filters_ref_array( 'users_pre_query', array
( null, &
$this ) );
if ( null ===
$this->results
) { $this->request = "
SELECT {
$this->query_fields
}
{
$this->query_from
}
{
$this->query_where
}
{
$this->query_orderby
}
{
$this->query_limit
}
";
$cache_value = false;
$cache_key =
$this->
generate_cache_key( $qv,
$this->request
);
$cache_group = 'user-queries';
if ( $qv['cache_results'
] ) { $cache_value =
wp_cache_get( $cache_key,
$cache_group );
} if ( false !==
$cache_value ) { $this->results =
$cache_value['user_data'
];
$this->total_users =
$cache_value['total_users'
];
} else { if ( is_array( $qv['fields'
] ) ) { $this->results =
$wpdb->
get_results( $this->request
);
} {
$wpdb->posts
}.*",
"{
$wpdb->posts
}.ID, {
$wpdb->posts
}.post_parent",
"{
$wpdb->posts
}.ID",
);
if ( !
in_array( $fields,
$cacheable_field_values, true
) ) { $id_query_is_cacheable = false;
} if ( $q['cache_results'
] &&
$id_query_is_cacheable ) { $new_request =
str_replace( $fields, "{
$wpdb->posts
}.*",
$this->request
);
$cache_key =
$this->
generate_cache_key( $q,
$new_request );
$cache_found = false;
if ( null ===
$this->posts
) { $cached_results =
wp_cache_get( $cache_key, 'post-queries', false,
$cache_found );
if ( $cached_results ) { if ( 'ids' ===
$q['fields'
] ) { /** @var int[] */
$this->posts =
array_map( 'intval',
$cached_results['posts'
] );
} else { _prime_post_caches( $cached_results['posts'
],
$q['update_post_term_cache'
],
$q['update_post_meta_cache'
] );