Is there a short-cut built-in function to obtain the user's Last_Login other than getting it through this method which I suspect can slow down the Application's performance:
GetUser(GetUserId()).User.Last_Login?
Or is this method the quickest and best method from the App performance point of view?
Seth wrote:
There isn't any built-in method that I know of, but if there was, it would do exactly what you wrote, since the DB is the data store of record for that information.
How often are you getting this data that you are concerned about performance of calling GetUser(GetUserId())?
J.Ja
Justin James wrote:
4 times in 4 different places. Would it be better upon login that I read this value into a Session variable instead of fetching it each time the user opens specific screens this funciton is called? I thought using session variables would be a little bad from an optimised code perspective. Or do I misunderstand the use of Session variables?
Thanks
4 DB reads of that little record is NOTHING, unless you are doing this 10,000 times a minute or something. I would not spend another moment of time worrying about this. :) And yes, putting it in Session isn't a good use of session (funny, I am working on an article about that now).
Hello,
If your concern is performance or the number of times you are executing the query, you just need an identification for that specific session, to be the input of a cached action that retrieves the Login information. If that action has cache for some period of time (Eg: 20m), you will disable it everytime you change the input value (change your session). Having that in mind, in this way you don't execute the query everytime you use the action to get that values :)
Kind regards
Miguel Sousa wrote:
Much appreciated
Thanks a ton for the reassurance