Jump to content

phpvms_sessions question


tutmeister

Recommended Posts

This table is huge in my database and I'd like to run the following as a weekly Cron Job:

<?php

$connect = @mysql_connect("localhost","username","password");

if (!$connect)
 {
 die('Could not connect: ' . mysql_error());
 }

@mysql_select_db("database");

// DELETE empties the table
$query = "DELETE FROM `phpvms_sessions` WHERE `logintime` < date_sub(NOW(), INTERVAL 2 DAY);";


mysql_query($query);

?>

Is there anything other than storing current login details that this table is responsible for that I would be screwing up by doing this?

The reason I am doing the above is that I have changed the MySQL table to the Memory Storage Engine and I don't want more than 2 day's worth of sessions loaded into memory.

Link to comment
Share on other sites

  • 2 weeks later...

Sorry Mark, I only just saw this reply. I'm not sure but I will take a look. It might possible kill all open sessions, but the issue at hand, for me at least, is not the amount of sessions. It's that it stores a record for each session which in turn unnecessarily is bloating my database with a year's worth of sessions (well not anymore, as I've run my script to delete them). My host (mediatemple) has a limit on the size a database can be, so I try to get rid of unnecessary bloat.

Link to comment
Share on other sites

  • 4 years later...
  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...