Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session: getLastAccessedTime()

 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the client’s been gone a long time and if I want to send them an email asking if they’re coming back or not.

Where do implement this?

The session object is retrieved from the request object.
If the client does not make any request for a long time, How to get the session object?
Is there any way to get list of all session objects and iterate?

Thanks
Kathir
 
Devaka Cooray
Marshal
Pie
Posts: 4896
409
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on Session objects is not a good practice for here. Because you need a data storage for a long time to approach this task.

Here, as the best solution, you can persist the last accessed time of each user to a database, so you can track it up anytime. For an example, if you are using a table named "Users" which contains some columns like "Name", "Password", ..... then you can insert another column as LastAccessedTime. (Or use this on another table, which is having a relationship with the Users table).

To send email notifications, you can use Timers or any other timed-method, so you can retrieve the users who didn't log-in for a long time. This can be done through an SQL statement or any other query language.

Cheers,

Devaka.
 
Kathiresan Chinna
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks

So, Do I need a process running in loop and checking the database with specific interval ?

Kathir
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic