This configuration helps you configure components using Redis. This so far only includes optional rate limiting component.

Consult this link:https://github.com/apache/james-project/blob/fabfdf4874da3aebb04e6fe4a7277322a395536a/server/mailet/rate-limiter-redis/redis.properties[example]
to get some examples and hints.

== Redis Configuration

.redis.properties content
|===
| Property name | explanation

| redisURL
| the Redis URI pointing to Redis server. Compulsory. The value must fit redis.topology

Reference: https://github.com/redis/lettuce/wiki/Redis-URI-and-connection-details

| redis.topology
| Redis server topology. Defaults to standalone. Possible values: standalone, cluster, master-replica, sentinel

| redis.readFrom
| The property to determine how Lettuce routes read operations to Redis server with topologies other than standalone. Defaults to master. Possible values: master, masterPreferred, replica, replicaPreferred, any

Reference: https://github.com/redis/lettuce/wiki/ReadFrom-Settings

| redis.sentinelPassword
| Redis sentinel password. If not specified, the redis driver will not set password for sentinel.

| redis.ssl.enabled
| To enable ssl connection. Defaults to false. Read TLS/SSL for more details.

| redis.ioThreads
| IO threads to be using for the underlying Netty networking resources. If unspecified driver defaults applies.

| redis.workerThreads
| Worker threads to be using for the underlying driver. If unspecified driver defaults applies.
|===

== Enabling Multithreading in Redis

Redis 6 and later versions support multithreading, but by default, Redis operates as a single-threaded process.

On a virtual machine with multiple CPU cores, you can enhance Redis performance by enabling multithreading. This can significantly improve I/O operations, particularly for workloads with high concurrency or large data volumes.

See link:https://redis.io/docs/latest/operate/oss_and_stack/management/config-file/[THREADED I/O section].

Example if you have a 4 cores CPU, you can enable the following lines in the `redis.conf` file:
....
io-threads 3
io-threads-do-reads yes
....

However, if your machine has only 1 CPU core or your Redis usage is not intensive, you will not benefit from this.

== TLS/SSL

To enable ssl mode, set `redis.ssl.enabled` to true. The keyword `rediss` must be used in redisURL. For example:
....
redisURL=rediss://123@localhost:6379?verifyPeer=NONE
....
Once ssl mode is enabled, the following properties can be specified:

|===
| Property name | explanation

| redis.ignoreCertificateCheck
| To tell James to ignore any certificate check when connecting to redis via ssl. Defaults to true. If the value is false, the key store file would be used for the check.

| redis.keystore.file.path
| The file path pointing to the p12 file containing private key, cert and ca cert. Defaults to cacerts file path in java home location.

| redis.keystore.password
| The password of the p12 file. Defaults to empty.
|===

Query params in `redisURL` could be used to specify some configs for Lettuce (Redis client lib used by James)

One of those query params is `verifyPeer`. By default, Lettuce verifies the certificate against the validity and the common name (Name validation not supported on Java 1.6, only available on Java 1.7 and higher) of the Redis host you are connecting to. This behavior can be turned off by `verifyPeer=NONE`

For more details about query paras supported in `redisURL` as well as other Lettuce support for TLS/SSL, consult this link:
https://github.com/redis/lettuce/wiki/SSL-Connections