Changes To WordPress Object Caching In 2.5

Jacob SantosFuncDoc notes:

The WordPress Object Cache changed in WordPress 2.5 and removed a lot of file support from the code. This means that the Object Cache in WordPress 2.5 is completely dependent on memory and will not be saved to disk for retrieval later. The constant WP_CACHE also changed its meaning.

I’ve just started using the object cache and I’m happy with how it works now, so these changes are somewhat concerning. On the other hand, I’m confident that I’ll see even more performance gains once I get my head around the new cache and figure out how to implement it.

Extra: Peter Westwood’s Cache Inspect looks useful.

5 thoughts on “Changes To WordPress Object Caching In 2.5

  1. Actually, if you use the functions, you will have no problems, a few functions were removed, but all of the functions that plugin authors and core uses are still there and will remain. The only functionality that was removed was the enable cache and disable cache constants, so you can only disable the cache by using the new constant and replacing the current cache.

    By using the caching functions you are doing your users a favor, so keep up that good work!

  2. @Jacob Santos: I’ll definitely continue to code for them, but my concern is on the sysadmin side. The disk-based system is easy (if obviously not as efficient as a persistent memory-backed cache). I just need to learn more about that part.

  3. I found some problem in using Object Cache in WordPress 2.5.

    I have use the function wp_cache_set to cache the object, then I use the function wp_cache_get to get the object, but it return false.

    the cache function in my plugin works in WordPress 2.3, but it doesn’t work on WordPress 2.5

    can you help me to have a look my plugin?
    my plugin is

    thanks in advance 🙂

  4. I will say, that it appears that you are setting the top commentors after you call the get cache function. Following the logic, your plugin would preform best with disk caching where it would just pull from that.

    I would keep it like that or use another caching plugin. Currently, it appears that you are caching it to memory after you try to get it, which doesn’t help on the next page load when it must still preform the SQL query.

Comments are closed.