Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
b3319f5d
Commit
b3319f5d
authored
Sep 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1051 from franzliedke/patch-30
[Session] Trigger garbage collection (sweep) manually
parents
175683f9
228f5722
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
payload.php
laravel/session/payload.php
+20
-4
No files found.
laravel/session/payload.php
View file @
b3319f5d
...
@@ -298,13 +298,29 @@ class Payload {
...
@@ -298,13 +298,29 @@ class Payload {
$this
->
cookie
(
$config
);
$this
->
cookie
(
$config
);
// Some session drivers implement the Sweeper interface meaning that
// Some session drivers implement the Sweeper interface meaning that
// they must clean up expired sessions manually.
If the driver is a
// they must clean up expired sessions manually.
Here we'll calculate
//
sweeper, we'll calculate
if we need to run garbage collection.
// if we need to run garbage collection.
$sweepage
=
$config
[
'sweepage'
];
$sweepage
=
$config
[
'sweepage'
];
if
(
$this
->
driver
instanceof
Sweeper
and
(
mt_rand
(
1
,
$sweepage
[
1
])
<=
$sweepage
[
0
])
)
if
(
mt_rand
(
1
,
$sweepage
[
1
])
<=
$sweepage
[
0
]
)
{
{
$this
->
driver
->
sweep
(
time
()
-
(
$config
[
'lifetime'
]
*
60
));
$this
->
sweep
();
}
}
/**
* Clean up expired sessions.
*
* If the session driver is a sweeper, it must clean up expired sessions
* from time to time. This method triggers garbage collection.
*
* @return void
*/
public
function
sweep
()
{
if
(
$this
->
driver
instanceof
Sweeper
)
{
$this
->
driver
->
sweep
(
time
()
-
(
Config
::
get
(
'session.lifetime'
)
*
60
));
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment