Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

OnApplicationStart - running table cleanup code ?

Participant ,
Jun 07, 2010 Jun 07, 2010

So to hold each session's shopping Cart I use a table called webCart, which includes merchandise_ID, qty , unqiue_session_ref , timestamp

If a user's session expires (20 mins) , the shopping cart rows become obsolete, and at present I have no mechanism to clean this up. I was wondering if OnApplicationStart could do this for me ? It could run some SQL query to check today's datestamp against those in the webCart table and delete rows aged more than 1 hour ?

What do you think ?

TOPICS
Getting started
535
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Jun 07, 2010 Jun 07, 2010

P.S.

OnApplicationStart() would not necessairly run every day, unless you

A) have a low use site that goes long periods with no users

AND|OR

B) set the applicaiton time out to a relatively low time.

The timeout is how long the application has to go WITHOUT BEING USED by anybody or anything (robots from search engines can keep an application alive).  Not how long it has been since the application started.

Translate
Valorous Hero ,
Jun 07, 2010 Jun 07, 2010

I would suggest OnSessionEnd() is a more logical choice.

Code in that function is ran when the session expires.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 07, 2010 Jun 07, 2010

P.S.

OnApplicationStart() would not necessairly run every day, unless you

A) have a low use site that goes long periods with no users

AND|OR

B) set the applicaiton time out to a relatively low time.

The timeout is how long the application has to go WITHOUT BEING USED by anybody or anything (robots from search engines can keep an application alive).  Not how long it has been since the application started.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2010 Jun 07, 2010

D'Oh!

OnSessionEnd, of course!

Thanks for the info about onApplicationEnd

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2010 Jun 07, 2010

Ian, once checkout is complete is it better to kill the user's session rather than let it expire naturally ?

If so, how ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 07, 2010 Jun 07, 2010
LATEST

You can't expire the session, but you could delete all the data stored in the session scope.  StructClear() or StructDelete() would be ways to do it whole sale.

Whether it is a good idea or not, depends on the requirements of your system.  But it is often done.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources