Lose caching of user DB misses. Wasn't working out that well.
git-svn-id: https://develop.svn.wordpress.org/trunk@6929 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c797fb35ff
commit
4e50a6d3e2
|
@ -126,15 +126,11 @@ function get_userdata( $user_id ) {
|
||||||
|
|
||||||
$user = wp_cache_get($user_id, 'users');
|
$user = wp_cache_get($user_id, 'users');
|
||||||
|
|
||||||
if ( '0' === $user )
|
if ( $user )
|
||||||
return false;
|
|
||||||
else if ( $user )
|
|
||||||
return $user;
|
return $user;
|
||||||
|
|
||||||
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id)) ) {
|
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE ID = %d LIMIT 1", $user_id)) )
|
||||||
wp_cache_add($user_id, 0, 'users');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
_fill_user($user);
|
_fill_user($user);
|
||||||
|
|
||||||
|
@ -174,8 +170,6 @@ function get_userdatabylogin($user_login) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$user_id = wp_cache_get($user_login, 'userlogins');
|
$user_id = wp_cache_get($user_login, 'userlogins');
|
||||||
if ( '0' === $user_id )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$user = false;
|
$user = false;
|
||||||
if ( false !== $user_id )
|
if ( false !== $user_id )
|
||||||
|
@ -184,10 +178,8 @@ function get_userdatabylogin($user_login) {
|
||||||
if ( false !== $user )
|
if ( false !== $user )
|
||||||
return $user;
|
return $user;
|
||||||
|
|
||||||
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_login = %s", $user_login)) ) {
|
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_login = %s", $user_login)) )
|
||||||
wp_cache_add($user_login, 0, 'userlogins');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
_fill_user($user);
|
_fill_user($user);
|
||||||
|
|
||||||
|
@ -209,9 +201,6 @@ function get_user_by_email($email) {
|
||||||
|
|
||||||
$user_id = wp_cache_get($email, 'useremail');
|
$user_id = wp_cache_get($email, 'useremail');
|
||||||
|
|
||||||
if ( '0' === $user_id )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
$user = false;
|
$user = false;
|
||||||
if ( false !== $user_id )
|
if ( false !== $user_id )
|
||||||
$user = wp_cache_get($user_id, 'users');
|
$user = wp_cache_get($user_id, 'users');
|
||||||
|
@ -219,10 +208,8 @@ function get_user_by_email($email) {
|
||||||
if ( false !== $user )
|
if ( false !== $user )
|
||||||
return $user;
|
return $user;
|
||||||
|
|
||||||
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_email = %s", $email)) ) {
|
if ( !$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_email = %s", $email)) )
|
||||||
wp_cache_add($email, 0, 'useremail');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
_fill_user($user);
|
_fill_user($user);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue