sprain / php-mysql-session-handler Goto Github PK
View Code? Open in Web Editor NEWwell, handle PHP sessions in MySQL
well, handle PHP sessions in MySQL
You can reduce the recommended DB table setup (at README.md):
CREATE TABLE IF NOT EXISTS `sessions` (
`id` varchar(32) NOT NULL,
`timestamp` int(10) unsigned DEFAULT NULL,
`data` mediumtext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I'd like to use your class in my project, but you haven't specified a proper license for your work, which means it automatically gets copyrighted and no one can use it without your explicit permission.
If your intent is to make this class usable, please insert a license, either as a LICENSE file in this repo, or in the header comment of your main class, so other people may use it as they wish.
(Good examples of free software licenses are GPL, MIT, BSD, Apache License, WTFPL, MPL)
I found the mistake in the SessionHandler.php file. On line 34 you name the function "setDbDetails" but in the expample.php file you call the function "setDbData". I realy like this class. I looked along time for something and your class is the first working i found. It's very good. Thanks
PerdiscoVideo
I have few questions about performance.
Why do you use REPLACE INTO instead of INSERT ON DUPLICATE KEY UPDATE. When you're only creating new sessions this maybe makes sense. But most of the time you're gonna update sessions. For a small amount of sessions the difference is barely seen, but for a anything bigger this would stress the database for no reason with deleting the record before inserting when you only want to update the column/columns.
Second questions is why do you delete older sessions in open method instead of relying on php session garbage collect? Your solution forces a delete in every user interaction for every user. GC would reduce the amount queries and the more users application has the bigger the advantage of gc would be.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.