WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Bug in APC object cache wp_cache_set() making it fail (7 posts)

  1. Scott Cariss
    Member
    Posted 11 months ago #

    In your drop in located at: wp-content/object-cache.php

    you have:

    ` function wp_cache_set($id, $data, $group = 'default', $expire = 0) {
    global $wp_object_cache;

    return $wp_object_cache->set($id, $data, $group, $expire);
    }`

    This appears correct order of args ( KEY, DATA, GROUP, EXPIRY )

    But then look into your APC implementation of set() in file: w3-total-cache/lib/W3/Cache/Apc.php

    you have:

    ` function set($key, $var, $expire = 0, $group = '0') {
    $key = $this->get_item_key($key);

    $var['key_version'] = $this->_get_key_version($group);

    return apc_store($key . '_' . $this->_blog_id, serialize($var), $expire);
    }`

    Notice you have got EXPIRY and GROUP the oposite way round. So group is getting set as expiry and visa-versa.

    This breaks APC opcode functionality in the plugin and by switching them the correct way round opcode caching functions correctly...

    http://wordpress.org/plugins/w3-total-cache/

  2. Scott Cariss
    Member
    Posted 11 months ago #

    At the end there I say opcode caching but meant to say object caching. Sorry for any confusion.

  3. B_Dark
    Member
    Posted 11 months ago #

    (i use 2 apc on my vps)
    i my case i deactivate on my 3.6 multisite the plugin and still active(!!) and it doesn't show me the the link to delete the plugin via the admin

    also, i got this error on my error_log

    [15-Aug-2013 15:23:30 UTC]
    Error Table 'xxxx_dbsp.wp_users' doesn't exist database WordPress for request SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = 'wp_3_capabilities' ) from do_action_ref_array, call_user_func_array, Yoast_Tracking->tracking, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
    [15-Aug-2013 15:49:25 UTC] WordPress database error Table 'xxxx_dbsp.wp_users' doesn't exist for query SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = 'wp_1_capabilities' ) made by do_action_ref_array, call_user_func_array, Yoast_Tracking->tracking, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
    [15-Aug-2013 15:53:23 UTC] WordPress database error Table 'xxxx_dbsp.wp_users' doesn't exist for query SELECT COUNT(*) FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) WHERE 1 = 1 AND ( wp_usermeta.meta_key = 'wp_2_capabilities' ) made by do_action_ref_array, call_user_func_array, Yoast_Tracking->tracking, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query

    for secutiry reasons i have change the prefix "wp_", but why he tried to find the deafualt? how can I fix this?

  4. archon810
    Member
    Posted 3 months ago #

    I don't think this is correct, actually. object-cache.php doesn't call w3-total-cache/lib/W3/Cache/Apc.php directly. In fact, it first calls ObjectCache.php, and only from there does it call to Apc.php, Memcached, php, etc.

    The order of params is actually correct once you look at set() in w3-total-cache/lib/W3/ObjectCache.php.

    I did, however, just spent days on figuring out why object caching doesn't work reliably, and I have figured it out after much blood, sweat, and tears.

    I'm going to post it separately, drop a link here, and attempt to get in contact with Frederick once again.

  5. archon810
    Member
    Posted 3 months ago #

  6. Frederick Townes
    Member
    Plugin Author

    Posted 2 months ago #

    As a more robust fix replace all $group = '0' with $group = '' in all source files (will affect files in /Cache folder + one file from pgcache).

  7. archon810
    Member
    Posted 2 months ago #

    Indeed, that's another fix that should resolve the underlying issue of mismatching params.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.