Session Management
Learn how sessions are managed in a Front-Commerce Application.
Front-Commerce is using Remix Session API to manage sessions. Two session adapters are available:
- File System (Used by default)
- Redis
File System
The file system adapter is the default adapter. It stores sessions in the file
system of the server within the .front-commerce/sessions
directory.
The File System adapter isn't recommended neither for development nor production. It may lead to performance issues and serialization errors (see this issue).
Redis
The Redis adapter stores sessions in a Redis instance. It is recommended for development and production environments.
You can enable it by setting the FRONT_COMMERCE_CLOUD_REDIS_SESSIONS_HOST
environment variable to the host of your Redis instance.
You can run a Redis instance locally using Docker with the following command:
docker run -p 6379:6379 --rm --name redis -d redis
Then add the following following environment variable to your .env
:
FRONT_COMMERCE_CLOUD_REDIS_SESSIONS_HOST=localhost