The local file system backend is the default choice for container image, VM image and repository scans.
Note
Internally, this backend uses BoltDB, which has an important limitation: only one process can access the cache at a time.
Subsequent processes attempting to access the cache will be locked.
For more details on this limitation, refer to the troubleshooting guide.
The memory backend stores analysis results in memory, which means the cache is discarded when the process ends.
This makes it useful in scenarios where caching is not required or desired.
It serves as the default for filesystem and SBOM scans and can also be employed for container image scans when caching is unnecessary.
To use the memory backend for a container image scan, you can use the following command:
The Redis backend is particularly useful when you need to share the cache across multiple Trivy instances.
You can set up Trivy to use a Redis backend with a command like this:
$trivyserver--cache-backendredis://localhost:6379
This approach allows for centralized caching, which can be beneficial in distributed or high-concurrency environments.
If you want to use TLS with Redis, you can enable it by specifying the --redis-tls flag.