General developer forum

USER-> Cached test (how to avoid?)

Picture of Ricardo Souza
USER-> Cached test (how to avoid?)

Friends, I have a USER-> test variable. It is updated several times during a session, however, Moodle caches the data and I only get an update of this variable if the user logs off and then logs on.

What mechanism can I use so that you do not have a cache for this variable?

I really need this help!


Average of ratings: -
Picture of Darko Miletić
Re: USER-> Cached test (how to avoid?)
Core developersParticularly helpful Moodlers

You should not be doing that. If there is some data that you want to store and update during the session use the global session object like this:

global $SESSION;

$SESSION->myitem = 123;

Average of ratings: Useful (1)