You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I was just wondering if the package implements the automatic TTL function in MongoDB?
I noticed that the package adds the last_activity field to the documents. What defines the TTL? is it the session lifetime configuration in Laravels session.php?
The text was updated successfully, but these errors were encountered:
Looking at the code (both in my Laravel package and the repo on gh), it does contain a function to support TTL:
publicfunctiongc($lifetime)
{
/* Note: MongoDB 2.2+ supports TTL collections, which may be used in * place of this method by indexing the "time_field" field with an * "expireAfterSeconds" option. Regardless of whether TTL collections * are used, consider indexing this field to make the remove query more * efficient. * * See: http://docs.mongodb.org/manual/tutorial/expire-data/ */$time = new \MongoDate(time() - $lifetime);
$this->getCollection()->remove(array(
$this->options['time_field'] => array('$lt' => $time),
));
returntrue;
}
But looking at the system.indexes collection of the database, it doesn't seem like the function is used, since, as I understand it, you need to define the 'last_activity' field as a TTL index (I'm really new to mdb, and my expertise is frontend), and a TTL collection can't use a _id index http://docs.mongodb.org/manual/core/index-ttl/
Hello
I was just wondering if the package implements the automatic TTL function in MongoDB?
I noticed that the package adds the last_activity field to the documents. What defines the TTL? is it the session lifetime configuration in Laravels session.php?
The text was updated successfully, but these errors were encountered: