Title: Bug in APC object cache wp_cache_set() making it fail
Last modified: August 21, 2016

---

# Bug in APC object cache wp_cache_set() making it fail

 *  [Scott Cariss](https://wordpress.org/support/users/l3rady/)
 * (@l3rady)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/)
 * 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/](http://wordpress.org/plugins/w3-total-cache/)

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

 *  Thread Starter [Scott Cariss](https://wordpress.org/support/users/l3rady/)
 * (@l3rady)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037546)
 * At the end there I say opcode caching but meant to say object caching. Sorry 
   for any confusion.
 *  [Be Dark](https://wordpress.org/support/users/b_dark/)
 * (@b_dark)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037667)
 * (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?
 *  [archon810](https://wordpress.org/support/users/archon810/)
 * (@archon810)
 * [12 years ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037791)
 * 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.
 *  [archon810](https://wordpress.org/support/users/archon810/)
 * (@archon810)
 * [12 years ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037792)
 * Here we go: [http://wordpress.org/support/topic/self-diagnosed-and-fixed-w3-total-cache-bug-in-faulty-object-caching](http://wordpress.org/support/topic/self-diagnosed-and-fixed-w3-total-cache-bug-in-faulty-object-caching).
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [12 years ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037793)
 * 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).
 *  [archon810](https://wordpress.org/support/users/archon810/)
 * (@archon810)
 * [12 years ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037794)
 * Indeed, that’s another fix that should resolve the underlying issue of mismatching
   params.

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

The topic ‘Bug in APC object cache wp_cache_set() making it fail’ is closed to new
replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [archon810](https://wordpress.org/support/users/archon810/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/bug-in-apc-object-cache-wp_cache_set-making-it-fail/#post-4037794)
 * Status: not resolved