1. Add the Redis service
-
Add the service to your app configuration using the
servicestop-level key:.upsun/config.yaml -
To connect the service to your app, add the following relationship:
.upsun/config.yaml
2. Configure your Redis service
The Redis configuration is exposed via the following environment variables (whereREDIS is the upper-cased version of the key defined in the relationship):
REDIS_URL: The Redis URLREDIS_HOST: The Redis hostREDIS_PORT: The Redis portREDIS_SCHEME: The Redis scheme
redis, Laravel automatically detects these variables and configure its own Redis driver the right way.
If not, you can map the variables in the .environment file.
You can specify the Redis client in your .environment file:
.environment
3. Store the Laravel cache in Redis
To enable cache storage in Redis, add the following environment variable to your.environment file:
.environment
4. Store Laravel sessions in Redis
Laravel relies on theSESSION_DRIVER variable to store sessions. Therefore, add the following environment variable to your .environment file:
.environment
5. Use Redis for Laravel queues
For a basic queueing system, configure theQUEUE_CONNECTION in your .environment file as follows:
.environment