Cache user ids and user logins separately to avoid collision. Props donncha. fixes #2096
git-svn-id: http://svn.automattic.com/wordpress/trunk@3330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4f3bef3ac1
commit
a626f32296
|
@ -241,7 +241,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
|
||||
|
||||
wp_cache_delete($id, 'users');
|
||||
wp_cache_delete($user->user_login, 'users');
|
||||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
|
||||
do_action('delete_user', $id);
|
||||
|
||||
|
@ -354,4 +354,4 @@ function comment_exists($comment_author, $comment_date) {
|
|||
WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -58,7 +58,7 @@ class WP_Object_Cache {
|
|||
var $cache = array ();
|
||||
var $dirty_objects = array ();
|
||||
var $non_existant_objects = array ();
|
||||
var $global_groups = array ('users', 'usermeta');
|
||||
var $global_groups = array ('users', 'userlogins', 'usermeta');
|
||||
var $blog_id;
|
||||
var $cold_cache_hits = 0;
|
||||
var $warm_cache_hits = 0;
|
||||
|
@ -370,4 +370,4 @@ class WP_Object_Cache {
|
|||
$this->blog_id = md5($blog_id);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -2212,7 +2212,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
|
|||
|
||||
$user = get_userdata($user_id);
|
||||
wp_cache_delete($user_id, 'users');
|
||||
wp_cache_delete($user->user_login, 'users');
|
||||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2234,7 +2234,7 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
|
|||
|
||||
$user = get_userdata($user_id);
|
||||
wp_cache_delete($user_id, 'users');
|
||||
wp_cache_delete($user->user_login, 'users');
|
||||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ function get_userdata( $user_id ) {
|
|||
} //end if
|
||||
|
||||
wp_cache_add($user_id, $user, 'users');
|
||||
wp_cache_add($user->user_login, $user, 'users');
|
||||
wp_cache_add($user->user_login, $user, 'userlogins');
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function get_userdatabylogin($user_login) {
|
|||
if ( empty( $user_login ) )
|
||||
return false;
|
||||
|
||||
$userdata = wp_cache_get($user_login, 'users');
|
||||
$userdata = wp_cache_get($user_login, 'userlogins');
|
||||
if ( $userdata )
|
||||
return $userdata;
|
||||
|
||||
|
@ -101,7 +101,7 @@ function get_userdatabylogin($user_login) {
|
|||
}
|
||||
|
||||
wp_cache_add($user->ID, $user, 'users');
|
||||
wp_cache_add($user->user_login, $user, 'users');
|
||||
wp_cache_add($user->user_login, $user, 'userlogins');
|
||||
|
||||
return $user;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ function wp_insert_user($userdata) {
|
|||
}
|
||||
|
||||
wp_cache_delete($user_id, 'users');
|
||||
wp_cache_delete($user_login, 'users');
|
||||
wp_cache_delete($user_login, 'userlogins');
|
||||
|
||||
if ( $update )
|
||||
do_action('profile_update', $user_id);
|
||||
|
|
Loading…
Reference in New Issue