Skip to:

Memcached is breaking private messaging

  • gregfielding


    I’ve got a large blog farm with multi-db’s using memcached & batcache to handle the load. The problem is that with BP, if I click to send a private message to a user, it shows the wrong recipient on the composition screen.
    If I flush the cache and try again it works.

    Has anyone else been able to tweak the caching settings with object-cache.php or advanced-cache.php to get this to work?

    Here’s what I have:

    function batcache_cancel() {
    global $batcache;

    if ( is_object($batcache) )
    $batcache->cancel = true;

    class batcache {
    // This is the base configuration. You can edit these variables or move them into your wp-config.php file.
    var $max_age = 180; // Expire batcache items aged this many seconds (zero to disable batcache)

    var $remote = 0; // Zero disables sending buffers to remote datacenters (req/sec is never sent)

    var $times = 2; // Only batcache a page after it is accessed this many times… (two or more)
    var $seconds = 0; // …in this many seconds (zero to ignore this and use batcache immediately)

    var $group = ‘batcache44’; // Name of memcached group. You can simulate a cache flush by changing this.

    var $unique = array(); // If you conditionally serve different content, put the variable values here.

    Is there some way to exclude the message page?


Viewing 6 replies - 1 through 6 (of 6 total)

  • teebes


    Hmm, I was under the impression batcache would only cache public pages (non-logged in users). The above seems to indicate otherwise. Is batcache really buddypress aware (I noticed the last update of the plugin via the repo was back in April ’09).

    Probably more the other way; that BuddyPress needs to communicate when caches need to be refreshed better.



    Batcache isn’t supposed to impact logged-in users, so it seemed like a natural fit for BP.

    Paul, you think this is a BP issue as opposed to just tweaking a caching setting?

    I know that there are people using BP with memcached and W3Total cache…are any of you guys having trouble with this? (W3TC doesn’t worth with multi-db’s or I’d be using it)



    Check out:

    You can temporarily fix private messaging by overriding the username filter. See #2583 for hints.




    Thanks for the link, but I’m confused a bit. My current code already has that patch in it, changing the “public” to “private” looks to be the only switch. I’m guessing this was changed in a more recent BP release?

    And, you said:

    “With the patch, you’d still need to apply a filter to “bp_get_send_private_message_link” and override it so it doesn’t use bp_core_get_username().

    The same problem occurs with the bp_get_send_public_message_link() function – aka the “Mention this user” link.”

    It sounds like this is the step I need to take. How exactly do I apply this filter?




    Just to update, I applied the code from the patch with no luck. Here’s what my messages-templatetags.php code now says:

    function bp_send_private_message_link() {
    echo bp_get_send_private_message_link();
    function bp_get_send_private_message_link() {
    global $bp;

    if ( bp_is_my_profile() || !is_user_logged_in() )
    return false;

    return apply_filters( ‘bp_get_send_private_message_link’, $bp->loggedin_user->domain . $bp->messages->slug . ‘/compose/?r=’ . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) );

    It looks like I now need to “apply a filter to “bp_get_send_private_message_link” and override it so it doesn’t use bp_core_get_username().” Anyone know how to do this?

    Thanks guys.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Memcached is breaking private messaging’ is closed to new replies.
Skip to toolbar