Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.4, What is the best session driver for an e-commerce website

Hello i need help to decide what the best session driver i must use in my e-commerce website. Redis? Memcached? file driver? or other?

like image 505
Codinga Avatar asked Jun 17 '17 14:06

Codinga


People also ask

What is session in laravel 8?

Sessions are used to store information about the user across the requests. Laravel provides various drivers like file, cookie, apc, array, Memcached, Redis, and database to handle session data. By default, file driver is used because it is lightweight. Session can be configured in the file stored at config/session.

How do I create a session in blade?

User has to make a booking. If the user is not logged in I have to set a session with the $event->id. Then after he logs in should be redirected to booking form blade.


1 Answers

It depends on your setup

If you choose the file session driver, your session data will be saved in the app/storage/sessions folder on the server.

If you choose the database session driver, you can use the DB to keep sessions.

Otherwise, you can store the data (encrypted) in the user cookies.

Why use file driver:-

The advantage of using the file driver could be that mySQL/SQL server load whereas file access should be faster.

Why use database driver:-

If your site isn't that big (couple hundreds unique a day). It also provides you with easy access to all the users logged in from a time period so you can track stuff.

Why use Redis / Memcached driver:-

Redis & Memcached driver both provide high reading speed. so when you need to frequently access data, this is your best choice & also if your site is very big & the data read/write frequency is high.

So choose any of them according to your need.

like image 110
Manish Yadav Avatar answered Oct 20 '22 17:10

Manish Yadav