-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code to delete expired session entries from database #81
Conversation
this table stores the time when expired session sweep operation was last executed
getSweeptimeDifference(): returns time difference between present time and time when expired session entries were last deleted clearExpiredSession(): deletes expired sessions from database and update the date in session_last_sweeped table
This query deletes associated data from SESSION_DATA when expired session entries are removed from SESSION table
@paulocmguerreiro have a look now, I have implemented code to delete data from session_data as well while deleting expired session entries |
@mebjas , it's perfect Although, my opinion, you should call it from a LogOut Session instead of LogIn. At logout time the user can wait a little longer (when this script runs) without any hassle. I normally get more stressed when the login gets delayed that at the logout :) Question: |
Does SQLite support all these database things? Or PostgreSQL in a compatible manner? I know the current tests only use MySQL, but I think using fancy DB stuff can pose an obstacle. I'd try to avoid it if possible. Paulo Guerreiro notifications@github.com schrieb:
Mit freundlichen Grüßen Sven Rautenberg |
+1 Sven, Notice: This message is digitally signed, its source and integrity are verifiable. On Oct 31, 2013, at 1:08 PM, SvenRtbg notifications@github.com wrote:
|
@SvenRtbg you have a good argument there. :) |
@paulocmguerreiro but users don't log out usually! what if user closes the browser without actually logging out? on the other hand if this functionality is called during creation of new session, it would be called for few users only and the query wont take a very considerable amount of time as expired sessions are being deleted time to time. |
don’t worry much about the performance, usually session tables are stored on memory, and also deleting records off a table is the fastest operation. Notice: This message is digitally signed, its source and integrity are verifiable. On Oct 31, 2013, at 4:37 PM, minhaz notifications@github.com wrote:
|
@abiusx I think you are with deleting expired session while newSession() function is called? |
I haven’t done the code :D I’m not deleting them. Notice: This message is digitally signed, its source and integrity are verifiable. On Oct 31, 2013, at 4:54 PM, minhaz notifications@github.com wrote:
|
Couple of things as a summary in the above commits:
Now in this method, you created a new table which will at all time will Have a look on the requirement again...what we want is to sweep the function _Sweep($force=false) If we put this code in creation of new session, we get what we desire. On Thu, Oct 31, 2013 at 7:47 PM, AbiusX notifications@github.com wrote:
Regards, |
Can anyone help me with The Travis CI.... I don't get why its failing? |
As mentioned by Rahul if we go for probabilistic approach we do not need to keep an extra table to store just one row.
As mentioned by Rahul I have replaced the time based sweeping of expired session by including a probability factor to the function. Also the JOIN in sql query has been replaced by multiple queries to do the task separately.
I think I had mixed little of c++ with php, My bad!
The Travis CI build passed ! and now I get what it means ;) |
Create a new issue for this Notice: This message is digitally signed, its source and integrity are verifiable. On Dec 11, 2013, at 11:14 AM, minhaz notifications@github.com wrote:
|
as mentioned by Abbas the code checks for last time expired session entries were deleted and if its greater than a threshold time which I set as 60 minutes, and if it exceeds a single SQL query deletes all those entries in db which has expired.