Title: Cache zero values on object cache
Last modified: August 30, 2016

---

# Cache zero values on object cache

 *  [giodefreitas](https://wordpress.org/support/users/giodefreitas/)
 * (@giodefreitas)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/cache-zero-values-on-object-cache/)
 * Hi,
 * I’m having hard time to cache zero values on object cache.
 * After debugging I noticed that when W3_ObjectCache tries to get a value, check
   the if its a null value to avoid return it. But this check does not make a strict
   compare, so, a zero value is not returned too (lib\W3\ObjectCache.php, line 168).
 * Is this a bug or there is a workaround to this issue?
 * [https://wordpress.org/plugins/w3-total-cache/](https://wordpress.org/plugins/w3-total-cache/)

Viewing 1 replies (of 1 total)

 *  [Aaron Edwards](https://wordpress.org/support/users/uglyrobot/)
 * (@uglyrobot)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/cache-zero-values-on-object-cache/#post-6689253)
 * This is a terrible bug, you really need to fix. The codex recommended way to 
   check for expired transients is a strict compare against false:
    `if ( false 
   === ( $valid = get_site_transient( $key ) ) ) {`
 * But if you save a 0 to it, in the same page load it will return 0, but on subsequent
   it will return false. That means that the entire transient API is broken by this
   object cache right now in very common use cases.
 * This caused untold headaches for our popular WP Smush plugin, with 300k active
   installs. A few thousand of them were using your file-based object cache and 
   the API calls were no longer getting cached in transients. So we started getting
   API calls from every page load!
    [https://www.evernote.com/l/AImEDerGbO1Ay6_OrA6jvbNZmP6xm57rMk4B/image.png](https://www.evernote.com/l/AImEDerGbO1Ay6_OrA6jvbNZmP6xm57rMk4B/image.png)

Viewing 1 replies (of 1 total)

The topic ‘Cache zero values on object cache’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [Aaron Edwards](https://wordpress.org/support/users/uglyrobot/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/cache-zero-values-on-object-cache/#post-6689253)
 * Status: not resolved