• Hi

    According to this article, get_var is automatically cached. Does that mean i do not need to explicitly cache it in my own php call?

    A moderator over on buddypress.org says, “no, you have to explicity cache it, otherwise the results will not be cached.”

    What’s the correct answer?

    thx!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It depends on what cache you’re referring to. The result is automatically saved in $wpdb->last_result. Not technically a true cache, and the value is overwritten as soon as another query is run. Thus, if you want to use the result later, you’d best explicitly save it yourself. $last_result is only useful when used immediately as part of the same get_var() process.

Viewing 1 replies (of 1 total)

The topic ‘Is `get_var` Automatically Cached?’ is closed to new replies.