Skip to content

dfbag7/session-lazy-write

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lazy-write sessions for Laravel 4.2

Rational

The Laravel's sessions implementation overwrites session data at end of each request, and that produces problems when executing a lot of requests simultaneously.

One of possible solutions for that problem is to write session data only when it has been changed. Such an approach greatly reduces the risk of conflicting updates of the session data.

So, this implementation of sessions writes the session data only when the following conditions are met:

  1. either new or old flash data are not empty
  2. any attribute in the session data has been changed, added, or removed

Implications/drawbacks

The session's metadata object will contain wrong information about the session's last used time. Hopefully, that information is not used in Laravel 4.2.

Installation

Make these changed to composer.json file:

    "repositories": [
        //...
        {
            "url": "https://github.com/dfbag7/session-lazy-write.git",
            "type": "git"
        }
    ],
    "require": {
        // ...
        "dfbag7/session-lazy-write": "dev-master"
    },
    //...

Then run composer update

In app\config\app.php, replace line

        'Illuminate\Session\SessionServiceProvider',

with this:

        'Dfbag7\SessionLazyWrite\SessionLazyWriteServiceProvider',

About

Lazy write session support for Laravel 4.2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages