Title: Omit Something?
Last modified: April 13, 2024

---

# Omit Something?

 *  Resolved [Billy Wilcosky](https://wordpress.org/support/users/wilcosky/)
 * (@wilcosky)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/omit-something/)
 * Currently, this plugin caches data from a user frontend profile plugin I use.
   The problem with this is that when a user updates their profile data, sometimes
   their latest changes don’t show. Flushing this plugin’s cache fixes the problem.
   Temporarily.
   Is there a function I could pop into functions.php that would tell
   this plugin, “Hey, don’t cache xyz_user_field_meta.” In other words, is there
   a way to omit a certain Cache Group?

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

 *  Plugin Author [OllieJones](https://wordpress.org/support/users/olliejones/)
 * (@olliejones)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/omit-something/#post-17694355)
 * You could try calling wp_cache_add_non_persistent_groups() and mentioning the
   name of the group to refrain from caching. [https://developer.wordpress.org/reference/functions/wp_cache_add_non_persistent_groups/](https://developer.wordpress.org/reference/functions/wp_cache_add_non_persistent_groups/)
 * This is probably a bug in that other plugin.
 *  Thread Starter [Billy Wilcosky](https://wordpress.org/support/users/wilcosky/)
 * (@wilcosky)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/omit-something/#post-17694434)
 * Thank you for taking the time to provide a solution. I don’t think this solution
   is working for me. I tried:
 *     ```wp-block-code
       function add_non_persistent_groups() {
           wp_cache_add_non_persistent_groups(array('wpum_field_meta', 'user_meta'));
       }
   
       add_action('init', 'add_non_persistent_groups');
       ```
   
 * (Added the two groups I could see that involve user fields and that SQLite Object
   Cache is caching.)
   You may be right. It could be a plugin bug. It’s [WP User Manager](https://wordpress.org/plugins/wp-user-manager/).
   I can ask that plugin author what they think.This might defeat the purpose of
   using this plugin, but, could I add a function that completely clears the SQLite
   Object Cache every so many hours? I know this is likely possible, I’m just wondering
   if you instantly know how to do this to save me some time, to be honest.
 * Because in the end, bug or not, flushing the SQLite Object Cache fixes it. Until
   the next profile edit. Hmm 🤔 … I just thought that it would be interesting if
   the user meta group cache was cleared on profile save.
 *  Plugin Author [OllieJones](https://wordpress.org/support/users/olliejones/)
 * (@olliejones)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/omit-something/#post-17694534)
 * I’ll take a look at that plugin when I get a chance.
 * wp_cache_flush() wipes the cache. You could try …
    1. Set up a shutdown action handler in an admin_init action handler.
    2. From the shutdown handler call wp_cache_flush(). This will cause the cache to
       be cleared at the end of any admin function.
 * But, i gotta say, that sounds like a kludge on top of a hack. This is weird.
 * I wonder if the same problem occurs with the redis persistent object cache plugin?
 * Weird. Thanks for letting me know about this.
 *  Thread Starter [Billy Wilcosky](https://wordpress.org/support/users/wilcosky/)
 * (@wilcosky)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/omit-something/#post-17694561)
 * For now, even though it’s hacky, I’m going with this so I can still use your 
   plugin and all profile fields update. Maybe only profile_update is needed. But,
   what’s a couple other flushes at this point. 🤷‍♂️
 *     ```wp-block-code
       function flush_cache_on_user_change( $user_id ) {
           wp_cache_flush();
       }
   
       // Flush on user profile update.
       add_action( 'profile_update', 'flush_cache_on_user_change', 10, 1 );
   
       // Flush on new user registration.
       add_action( 'user_register', 'flush_cache_on_user_change', 10, 1 );
   
       // Flush on user deletion.
       add_action( 'delete_user', 'flush_cache_on_user_change', 10, 1 );
       ```
   
 *  Plugin Author [OllieJones](https://wordpress.org/support/users/olliejones/)
 * (@olliejones)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/omit-something/#post-17694849)
 * Looks good to me.
 * Double-check that the actions you hook happen at the END of the update operations.
   I guess the plugin is writing usermeta data directly to the data base with SQL,
   bypassing the usermeta cache. You Can’t Do That.(tm)
 * So other things that DO use it get stale data …. but only if the cache persists.
   I think that is consistent f with the failure you saw. Right?
 * We’ll soon know if my guess is correct.
 *  Plugin Author [OllieJones](https://wordpress.org/support/users/olliejones/)
 * (@olliejones)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/omit-something/#post-17697277)
 * That’s a complex plugin! and full of direct use of the wp_cache subsystem. It’s
   going to take some debugging.
 * It would be helpful if you could give me some steps to reproduce the problem 
   you have. Thanks!
 *  Thread Starter [Billy Wilcosky](https://wordpress.org/support/users/wilcosky/)
 * (@wilcosky)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/omit-something/#post-17697414)
 * Take your time. I could be the only person with the problem. And, at least I 
   have a solution for now (the cache purge on profile update code). This plugin
   speeds up my site so much that it’s still worth it even if I have to have a permanent
   hack.
 * To reproduce, ensure you have a frontend profile. Edit the bio/description in
   the profile. Save. Go and view the frontend profile. Try with your plugin and
   without.

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

The topic ‘Omit Something?’ is closed to new replies.

 * ![](https://ps.w.org/sqlite-object-cache/assets/icon-128x128.jpg?rev=2829632)
 * [SQLite Object Cache](https://wordpress.org/plugins/sqlite-object-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sqlite-object-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sqlite-object-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/sqlite-object-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sqlite-object-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sqlite-object-cache/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Billy Wilcosky](https://wordpress.org/support/users/wilcosky/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/omit-something/#post-17697414)
 * Status: resolved