• We have a site with 40k+ users, each of whom has a profile with about 40 pieces of information about them. At the moment for each page a user visits this info is collected from the db and used on the page’s plugin. (We have lots of small in-house plugins doing various things depending on their profile info.)

    But would it be possible/faster/easier if we collected an array of profile info when a user logged in and passed it from page to page (i.e. plugin to plugin) using a global array variable?

    Or perhaps keep it always at hand using some other system?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    If the data is repeatedly used during the same request, there is advantage to caching data in a global. A global already exists for such use, the WP object cache. Between requests it wouldn’t accomplish anything because the cache must be rebuilt each time.

    There are various ways to pass data between requests, but for logged in users I think there’s little to be gained over fetching data once from the DB. What you want to avoid is repeatedly getting the same DB data during one request.

    Thread Starter arathra

    (@arathra)

    Thanks, I’ll take a look at the WP Object Cache.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘user data as a global array?’ is closed to new replies.