mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-02 03:30:54 +00:00
Cache updates (#7388)
* Add redis container to development setup * Improve configurability of global cache: - Push configuration into separate file * Settings cache default depends on global cache configuration * Update docker compose file * Remove debug flag * Allow caching for registry checks * Cleanup docstring * Adjust defautl behaviour * Update docs for caching * Adjust default docker compose file * Update docs for devcontainer * Cleanup config template file * Update docker docs * Update cache behaviour
This commit is contained in:
@ -202,6 +202,35 @@ If running with a MySQL database backend, the following additional options are a
|
||||
| --- | --- | --- | --- |
|
||||
| INVENTREE_DB_ISOLATION_SERIALIZABLE | database.serializable | Database isolation level configured to "serializable" | False |
|
||||
|
||||
## Caching
|
||||
|
||||
InvenTree can be configured to use [redis](https://redis.io) as a global cache backend.
|
||||
Enabling a global cache can provide significant performance improvements for InvenTree.
|
||||
|
||||
### Cache Server
|
||||
|
||||
Enabling global caching requires connection to a redis server (which is separate from the InvenTree database and web server). Setup and configuration of this server is outside the scope of this documentation. It is assumed that if you are configuring a cache server, you have already set one up, and are comfortable configuring it.
|
||||
|
||||
!!! tip "Docker Support"
|
||||
If you are running [InvenTree under docker](./docker.md), we provide a redis container as part of our docker compose file - so redis caching works out of the box.
|
||||
|
||||
### Cache Settings
|
||||
|
||||
The following cache settings are available:
|
||||
|
||||
| Environment Variable | Configuration File | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| INVENTREE_CACHE_ENABLED | cache.enabled | Enable redis caching | False |
|
||||
| INVENTREE_CACHE_HOST | cache.host | Cache server host | *Not specified* |
|
||||
| INVENTREE_CACHE_PORT | cache.port | Cache server port | 6379 |
|
||||
| INVENTREE_CACHE_CONNECT_TIMEOUT | cache.connect_timeout | Cache connection timeout (seconds) | 3 |
|
||||
| INVENTREE_CACHE_TIMEOUT | cache.timeout | Cache timeout (seconds) | 3 |
|
||||
| INVENTREE_CACHE_TCP_KEEPALIVE | cache.tcp_keepalive | Cache TCP keepalive | True |
|
||||
| INVENTREE_CACHE_KEEPALIVE_COUNT | cache.keepalive_count | Cache keepalive count | 5 |
|
||||
| INVENTREE_CACHE_KEEPALIVE_IDLE | cache.keepalive_idle | Cache keepalive idle | 1 |
|
||||
| INVENTREE_CACHE_KEEPALIVE_INTERVAL | cache.keepalive_interval | Cache keepalive interval | 1 |
|
||||
| INVENTREE_CACHE_USER_TIMEOUT | cache.user_timeout | Cache user timeout | 1000 |
|
||||
|
||||
## Email Settings
|
||||
|
||||
To enable [email functionality](../settings/email.md), email settings must be configured here, either via environment variables or within the configuration file.
|
||||
|
@ -136,10 +136,8 @@ This container uses the official [redis image](https://hub.docker.com/_/redis).
|
||||
Docker adds an additional network layer - that might lead to lower performance than bare metal.
|
||||
To optimize and configure your redis deployment follow the [official docker guide](https://redis.io/docs/getting-started/install-stack/docker/#configuration).
|
||||
|
||||
!!! warning "Disabled by default"
|
||||
The *redis* container is not enabled in the default configuration. This is provided as an example for users wishing to use redis.
|
||||
To enable the *redis* container, run any `docker compose` commands with the `--profile redis` flag.
|
||||
You will also need to un-comment the `INVENTREE_CACHE_<...>` variables in the `.env` file.
|
||||
!!! tip "Enable Cache"
|
||||
While a redis container is provided in the default configuration, by default it is not enabled in the Inventree server. You can enable redis cache support by following the [caching configuration guide](./config.md#caching)
|
||||
|
||||
### Data Volume
|
||||
|
||||
|
Reference in New Issue
Block a user