简体   繁体   中英

does Apache caches the SESSION data in memory when I use the file handler for session?

In PHP, when I use the file handler for session storing,does Apache caches the SESSION in memory?
If not, would a usage of db storage engine on memory tables (mysql) would be a good idea?

Apache by itself doesn't "cache" the session file to memory : Apache has nothing to do with the session : it's purely something related to PHP, and unrelated to Apache.

PHP itself doesn't "cache" the session file to memory either : it writes it to disk (And, for security, the operating system probably really writes that file to disk)


Using a database could help, maybe, about disk-access ; but it would mean a network connection to another server, it would make MySQL work... Not necessarily that great.

Instead, I would rather use memcached to store my session ; it's a network daemon (which works in clusters, which means you can have several machines with memcached servers -- useful if you don't have enough memory on one server) that stores data in memory.

And memcached is quite frequently used to store session data -- I'm currently using memcached for that (amongst other things) on a project.

See the memcache section of the PHP manual : you'll need to install a PHP extension, if you want to communicate with memcached.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM