Last_login in Users entity

Last_login in Users entity

  
Hello everyone.

I'm using last_login field to get last time user loged in.
The problem is: this field is always being updated during the session. Even if don't use the web application.

I tried this on different environments and I hadn't this issue.
I have community edition installed on my machine and server is running on my machine too.

Is it normal?

Thank you!
Additional info: on my machine I have 7.0.1.7 version installed.
I tried on 7.0.1.5 version and it works fine (different server).
Hi Ricardo,

The last_login date is only changed when Login actions are called.
The applications that are running on the different machines are the same?
What user provider you using (Users/Enterprise Manager)?

Regards,
João Rosado
Hi João.
Yes, it's the same application running in different environments.
I'm using Users.

Regards

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:

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?

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:

Seth wrote:

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?

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


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


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:

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




Much appreciated

Seth wrote:

Justin James wrote:

Seth wrote:

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?

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


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).

J.Ja

Thanks a ton for the reassurance