• Resolved islp

    (@islp)


    $query = new WP_User_Query([

                'meta_query' => [

                    [

                        'key' => 'ISP_ACCESS_LINK',

                        'value' => '',

                        'compare' => '=',

                    ],

                ],

            ]);

    In a plugin I have this above query.

    This query gets called in the body of a WP endpoint by an external cronjob.

    So, to summarize: a remote website, every 10 minutes calls a WP endpoint where I have this query.

    Problem is it looks like results are “cached”: I suppose this because after the call, the key ISP_ACCESS_LINK has for sure a value different from the empty string (I verified at the database level).

    The strange thing is the value inside is always different than before, but the query reacts like there’s always empty string in the meta.

    Could it be a cache issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter islp

    (@islp)

    I solved by adding ‘cache_results’ => false to my query. I’m not sure if SQLite Object cache is related to this issue at this point – otherwise it would be interesting to add a feature to whitelist custom rest endpoints.

    Plugin Author OllieJones

    (@olliejones)

    User metadata and user queries are definitely cached. But changing the metadata via update_user_meta or add_user_meta should reset the cached data. (Doing it directly via SQL will not.)

    The persistent object cache API doesn’t support selective use based on which endpoints or pages are being used. It is possible to use wp_cache_add_non_persistent_groups() to control persistence for various cache-groups (categories of cached information). But I doubt that will address your issue.

    Does the problem also occur if no persistent object cache is in use?

    I’m not sure I can troubleshoot this further for you without more information.

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

You must be logged in to reply to this topic.