• Resolved Leo.Lin

    (@bi1012037)


    OS:ubuntu 20.04.6
    WordPress:6.4.3
    Redis:2.5.0
    Question:
    Due to the high frequency of member updates in the database table named wp_usermeta with meta_key as valid , Redis plugins may retrieve old values. How can I find this Key value or set to exclude it from caching?

    SQL:SELECT meta_value FROM wp_usermeta WHERE user_id=10 and meta_key =valid;
    PHP:get_user_meta( “10”, ‘valid’, true );=>Old value

    Current approach:

    1. Find the naming convention for the key and clear it.
    2. Edit the redis.conf file.
    3. Add code to exclude the table named wp_usermeta from the Redis plugin in function.php.

    Recently started exploring Redis and seeking advice on viable methods. I aim to keep wp_usermeta updated with the latest values as much as possible. Thanks!


    • This topic was modified 1 year ago by Leo.Lin.
    • This topic was modified 1 year ago by Leo.Lin.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Leo.Lin

    (@bi1012037)


    I have found the key value wp:user_meta:$user_id. Next, I will see how to filter it. Case closed.

    Plugin Author Till Krüss

    (@tillkruess)

    You can ignore the user_meta cache group. More info in the README.

    Thread Starter Leo.Lin

    (@bi1012037)

    @tillkruess I would like to inquire about the location of the README file for this plugin. Currently, I have only found the update log (readme.txt) within the plugin. I would like to see the usage instructions for “ignore the user_meta cache group”. Thank you.

    Update: I’ve found the README on GitHub now. Still not quite sure how to use this hook. Thank you for your advice!


    I added this code to Function.php, but it still doesn’t work. user_meta is still being added to the cache.

    add_filter( 'add_non_persistent_groups', 'ignore__redis_cache' );
    
    function ignore_redis_cache( $groups ) {
        $groups = array_merge( $groups, array( 'user_meta' ) );
        return $groups;
    }
    

    I successfully added the following code into wp-config.php and it worked!
    I will continue to try to figure out how to use hooks to filter cache groups.
    Reference URL: https://www.ads-software.com/support/topic/exclude-cache-group-question/

    define('WP_REDIS_IGNORED_GROUPS', ['user_meta'] );
    • This reply was modified 1 year ago by Leo.Lin.
    • This reply was modified 1 year ago by Leo.Lin.
    • This reply was modified 1 year ago by Leo.Lin.
    • This reply was modified 1 year ago by Leo.Lin.
    Plugin Author Till Krüss

    (@tillkruess)

    Correct, the WP_REDIS_IGNORED_GROUPS is the way to go ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to find the naming method of key value’ is closed to new replies.