From f45ca81ddaec41a5d946775ff54cf4f7d57764eb Mon Sep 17 00:00:00 2001 From: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Date: Wed, 28 May 2025 11:29:01 -0400 Subject: [PATCH] docs: recommendations for cache memory (#8140) * env-vars-table * remove-cache-table * fix-bool-cli-links * run-cache * note * code-review * support --- docs/docs/Configuration/configuration-cli.md | 18 ++++++++--------- .../Configuration/environment-variables.md | 7 +++---- docs/docs/Develop/memory.md | 20 +++++++------------ 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/docs/docs/Configuration/configuration-cli.md b/docs/docs/Configuration/configuration-cli.md index cb4c286fa..b1c27f043 100644 --- a/docs/docs/Configuration/configuration-cli.md +++ b/docs/docs/Configuration/configuration-cli.md @@ -85,8 +85,8 @@ python -m langflow migration [OPTIONS] | Option | Default | Values | Description | |--------|---------|--------|-------------| -| `--test` | `true` | [Boolean](#boolean) | Run migrations in test mode. Use `--no-test` to disable test mode. | -| `--fix` | `false` (`--no-fix`) | [Boolean](#boolean) | Fix migrations. This is a destructive operation, and all affected data will be deleted. Only use this option if you know what you are doing. | +| `--test` | `true` | Boolean | Run migrations in test mode. Use `--no-test` to disable test mode. | +| `--fix` | `false` (`--no-fix`) | Boolean | Fix migrations. This is a destructive operation, and all affected data will be deleted. Only use this option if you know what you are doing. | | `--help` | *Not applicable* | *Not applicable* | Display information about the command usage and its options and arguments. | ### langflow run @@ -111,14 +111,13 @@ python -m langflow run [OPTIONS] | `--env-file` | Not set | String | Path to the `.env` file containing environment variables.
See [Import environment variables from a .env file](./environment-variables.md#configure-variables-env-file). | | `--log-level` | `critical` | `debug`
`info`
`warning`
`error`
`critical` | Set the logging level.
See [`LANGFLOW_LOG_LEVEL` variable](./environment-variables.md#LANGFLOW_LOG_LEVEL). | | `--log-file` | `logs/langflow.log` | String | Set the path to the log file for Langflow.
See [`LANGFLOW_LOG_FILE` variable](./environment-variables.md#LANGFLOW_LOG_FILE). | -| `--cache` | `InMemoryCache` | `InMemoryCache`
`SQLiteCache` | Type of cache to use.
See [`LANGFLOW_LANGCHAIN_CACHE` variable](./environment-variables.md#LANGFLOW_LANGCHAIN_CACHE). | -| `--dev` | `false` (`--no-dev`) | [Boolean](#boolean) | Run Langflow in development mode (may contain bugs).
See [`LANGFLOW_DEV` variable](./environment-variables.md#LANGFLOW_DEV). | +| `--cache` | `async` | `async`
`redis`
`memory`
`disk` | Type of cache to use.
See [`LANGFLOW_CACHE_TYPE` variable](./environment-variables.md#LANGFLOW_CACHE_TYPE). | | `--frontend-path` | `./frontend` | String | Path to the frontend directory containing build files. This is for development purposes only.
See [`LANGFLOW_FRONTEND_PATH` variable](./environment-variables.md#LANGFLOW_FRONTEND_PATH). | -| `--open-browser` | `true` | [Boolean](#boolean) | Open the system web browser on startup. Use `--no-open-browser` to disable opening the system web browser on startup.
See [`LANGFLOW_OPEN_BROWSER` variable](./environment-variables.md#LANGFLOW_OPEN_BROWSER). | -| `--remove-api-keys` | `false` (`--no-remove-api-keys`) | [Boolean](#boolean) | Remove API keys from the projects saved in the database.
See [`LANGFLOW_REMOVE_API_KEYS` variable](./environment-variables.md#LANGFLOW_REMOVE_API_KEYS). | -| `--backend-only` | `false` (`--no-backend-only`) | [Boolean](#boolean) | Only run Langflow's backend server (no frontend).
See [`LANGFLOW_BACKEND_ONLY` variable](./environment-variables.md#LANGFLOW_BACKEND_ONLY). | -| `--store` | `true` | [Boolean](#boolean) | Enable the Langflow Store features. Use `--no-store` to disable the Langflow Store features.
See [`LANGFLOW_STORE` variable](./environment-variables.md#LANGFLOW_STORE). | -| `--auto-saving` | `true` | [Boolean](#boolean) | Enable flow auto-saving. Use `--no-auto-saving` to disable flow auto-saving.
See [`LANGFLOW_AUTO_SAVING` variable](./environment-variables.md#LANGFLOW_AUTO_SAVING). | +| `--open-browser` | `true` | Boolean | Open the system web browser on startup. Use `--no-open-browser` to disable opening the system web browser on startup.
See [`LANGFLOW_OPEN_BROWSER` variable](./environment-variables.md#LANGFLOW_OPEN_BROWSER). | +| `--remove-api-keys` | `false` (`--no-remove-api-keys`) | Boolean | Remove API keys from the projects saved in the database.
See [`LANGFLOW_REMOVE_API_KEYS` variable](./environment-variables.md#LANGFLOW_REMOVE_API_KEYS). | +| `--backend-only` | `false` (`--no-backend-only`) | Boolean | Only run Langflow's backend server (no frontend).
See [`LANGFLOW_BACKEND_ONLY` variable](./environment-variables.md#LANGFLOW_BACKEND_ONLY). | +| `--store` | `true` | Boolean | Enable the Langflow Store features. Use `--no-store` to disable the Langflow Store features.
See [`LANGFLOW_STORE` variable](./environment-variables.md#LANGFLOW_STORE). | +| `--auto-saving` | `true` | Boolean | Enable flow auto-saving. Use `--no-auto-saving` to disable flow auto-saving.
See [`LANGFLOW_AUTO_SAVING` variable](./environment-variables.md#LANGFLOW_AUTO_SAVING). | | `--auto-saving-interval` | `1000` | Integer | Set the interval for flow auto-saving in milliseconds.
See [`LANGFLOW_AUTO_SAVING_INTERVAL` variable](./environment-variables.md#LANGFLOW_AUTO_SAVING_INTERVAL). | | `--health-check-max-retries` | `5` | Integer | Set the maximum number of retries for the health check. Use `--no-health-check-max-retries` to disable the maximum number of retries for the health check.
See [`LANGFLOW_HEALTH_CHECK_MAX_RETRIES` variable](./environment-variables.md#LANGFLOW_HEALTH_CHECK_MAX_RETRIES). | | `--max-file-size-upload` | `100` | Integer | Set the maximum file size for the upload in megabytes.
See [`LANGFLOW_MAX_FILE_SIZE_UPLOAD` variable](./environment-variables.md#LANGFLOW_MAX_FILE_SIZE_UPLOAD). | @@ -142,7 +141,6 @@ python -m langflow superuser [OPTIONS] |--------|---------|--------|-------------| | `--username` | Required | String | Specify the name for the superuser.
See [`LANGFLOW_SUPERUSER` variable](./environment-variables.md#LANGFLOW_SUPERUSER). | | `--password` | Required | String | Specify the password for the superuser.
See [`LANGFLOW_SUPERUSER_PASSWORD` variable](./environment-variables.md#LANGFLOW_SUPERUSER_PASSWORD). | -| `--log-level` | `critical` | `debug`
`info`
`warning`
`error`
`critical` | Set the logging level. | ## Precedence diff --git a/docs/docs/Configuration/environment-variables.md b/docs/docs/Configuration/environment-variables.md index a76fd9479..a2fb4c544 100644 --- a/docs/docs/Configuration/environment-variables.md +++ b/docs/docs/Configuration/environment-variables.md @@ -182,7 +182,7 @@ The following table lists the environment variables supported by Langflow. | LANGFLOW_AUTO_SAVING_INTERVAL | Integer | `1000` | Set the interval for flow auto-saving in milliseconds.
See [`--auto-saving-interval` option](./configuration-cli.md#run-auto-saving-interval). | | LANGFLOW_BACKEND_ONLY | Boolean | `false` | Only run Langflow's backend server (no frontend).
See [`--backend-only` option](./configuration-cli.md#run-backend-only). | | LANGFLOW_BUNDLE_URLS | List[String] | `[]` | A list of URLs from which to load component bundles and flows. Supports GitHub URLs. If LANGFLOW_AUTO_LOGIN is enabled, flows from these bundles are loaded into the database. | -| LANGFLOW_CACHE_TYPE | `async`
`redis`
`memory`
`disk`
`critical` | `async` | Set the cache type for Langflow.
If you set the type to `redis`, then you must also set the following environment variables: LANGFLOW_REDIS_HOST, LANGFLOW_REDIS_PORT, LANGFLOW_REDIS_DB, and LANGFLOW_REDIS_CACHE_EXPIRE. | +| LANGFLOW_CACHE_TYPE | String | `async` | Set the cache type for Langflow. Possible values: `async`, `redis`, `memory`, `disk`.
If you set the type to `redis`, then you must also set the following environment variables: LANGFLOW_REDIS_HOST, LANGFLOW_REDIS_PORT, LANGFLOW_REDIS_DB, and LANGFLOW_REDIS_CACHE_EXPIRE. | | LANGFLOW_COMPONENTS_PATH | String | `langflow/components` | Path to the directory containing custom components.
See [`--components-path` option](./configuration-cli.md#run-components-path). | | LANGFLOW_CONFIG_DIR | String | See description | Set the Langflow configuration directory where files, logs, and the Langflow database are stored. Defaults: **Linux/WSL**: `~/.cache/langflow/`
**macOS**: `/Users//Library/Caches/langflow/`
**Windows**: `%LOCALAPPDATA%\langflow\langflow\Cache`| | LANGFLOW_DATABASE_URL | String | Not set | Set the database URL for Langflow. If not provided, Langflow uses a SQLite database. | @@ -191,14 +191,13 @@ The following table lists the environment variables supported by Langflow. | LANGFLOW_DB_MAX_OVERFLOW | Integer | `20` | **DEPRECATED:** Use LANGFLOW_DB_CONNECTION_SETTINGS instead. The number of connections to allow that can be opened beyond the pool size. | | LANGFLOW_DB_CONNECT_TIMEOUT | Integer | `20` | The number of seconds to wait before giving up on a lock to be released or establishing a connection to the database. | | LANGFLOW_DB_CONNECTION_SETTINGS | JSON | Not set | A JSON dictionary to centralize database connection parameters. Example: `{"pool_size": 10, "max_overflow": 20}` | -| LANGFLOW_DEV | Boolean | `false` | Run Langflow in development mode (may contain bugs).
See [`--dev` option](./configuration-cli.md#run-dev). | | LANGFLOW_ENABLE_LOG_RETRIEVAL | Boolean | `false` | Enable log retrieval functionality. | | LANGFLOW_FALLBACK_TO_ENV_VAR | Boolean | `true` | If enabled, [global variables](../Configuration/configuration-global-variables.md) set in the Langflow UI fall back to an environment variable with the same name when Langflow fails to retrieve the variable value. | | LANGFLOW_FRONTEND_PATH | String | `./frontend` | Path to the frontend directory containing build files. This is for development purposes only.
See [`--frontend-path` option](./configuration-cli.md#run-frontend-path). | | LANGFLOW_HEALTH_CHECK_MAX_RETRIES | Integer | `5` | Set the maximum number of retries for the health check.
See [`--health-check-max-retries` option](./configuration-cli.md#run-health-check-max-retries). | | LANGFLOW_HOST | String | `127.0.0.1` | The host on which the Langflow server will run.
See [`--host` option](./configuration-cli.md#run-host). | -| LANGFLOW_LANGCHAIN_CACHE | `InMemoryCache`
`SQLiteCache` | `InMemoryCache` | Type of cache to use.
See [`--cache` option](./configuration-cli.md#run-cache). | -| LANGFLOW_LOG_LEVEL | `DEBUG`
`INFO`
`WARNING`
`ERROR`
`CRITICAL` | `INFO` | Set the logging level for Langflow. | +| LANGFLOW_LANGCHAIN_CACHE | String | `InMemoryCache` | Type of cache to use. Possible values: `InMemoryCache`, `SQLiteCache`.
See [`--cache` option](./configuration-cli.md#run-cache). | +| LANGFLOW_LOG_LEVEL | String | `INFO` | Set the logging level for Langflow. Possible values: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. | | LANGFLOW_LOG_FILE | String | Not set | Path to the log file. If this option is not set, logs are written to stdout. | | LANGFLOW_LOG_RETRIEVER_BUFFER_SIZE | Integer | `10000` | Set the buffer size for log retrieval. Only used if `LANGFLOW_ENABLE_LOG_RETRIEVAL` is enabled. | | LANGFLOW_MAX_FILE_SIZE_UPLOAD | Integer | `100` | Set the maximum file size for the upload in megabytes.
See [`--max-file-size-upload` option](./configuration-cli.md#run-max-file-size-upload). | diff --git a/docs/docs/Develop/memory.md b/docs/docs/Develop/memory.md index 39282c47d..46846c77b 100644 --- a/docs/docs/Develop/memory.md +++ b/docs/docs/Develop/memory.md @@ -84,17 +84,11 @@ LANGFLOW_DB_CONNECT_TIMEOUT=20 ## Configure cache memory -Langflow provides multiple caching options that can be configured using the `LANGFLOW_CACHE_TYPE` environment variable. +The default Langflow caching behavior is an asynchronous, in-memory cache. +``` +LANGFLOW_LANGCHAIN_CACHE=InMemoryCache +LANGFLOW_CACHE_TYPE=Async +``` -| Type | Description | Storage Location | Persistence | -| ----------------- | ---------------------------- | ------------------------ | ---------------------- | -| `async` (default) | Asynchronous in-memory cache | Application memory | Cleared on restart | -| `memory` | Thread-safe in-memory cache | Application memory | Cleared on restart | -| `disk` | File system-based cache | System cache directory\* | Persists after restart | -| `redis` | Distributed cache | Redis server | Persists in Redis | - -\*System cache directory locations: - -- Linux/WSL: `~/.cache/langflow/` -- macOS: `/Users//Library/Caches/langflow/` -- Windows: `%LOCALAPPDATA%\langflow\langflow\Cache` \ No newline at end of file +Alternative caching options can be configured, but options other than the default asynchronous, in-memory cache are not supported. +The default behavior is suitable for most use cases. \ No newline at end of file