Skip to content

Commit 89dfc06

Browse files
Update cache configuration to support Redis-backed caching
1 parent e821980 commit 89dfc06

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

docs/content/guides/getting-started/configuration.mdx

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,85 @@ Stores user profiles and credentials.
121121

122122
## Cache Configuration
123123

124-
Thunder includes an in-memory caching layer to improve performance.
124+
Thunder includes both in-memory and Redis-backed caching to improve performance.
125125

126126
| Setting | Default | Description |
127127
|---------|---------|-------------|
128128
| `cache.disabled` | `false` | If `true`, disables caching entirely |
129-
| `cache.type` | `inmemory` | Cache type (currently only `inmemory` is supported) |
129+
| `cache.type` | `inmemory` | Cache type (`inmemory` or `redis`). When `cache.type` is `redis`, Thunder does not use the periodic cleanup routine. |
130130
| `cache.size` | `1000` | Maximum number of cache entries |
131131
| `cache.ttl` | `3600` | Default time-to-live for cache entries in seconds |
132132
| `cache.eviction_policy` | `LRU` | Cache eviction policy (`LRU` - Least Recently Used) |
133-
| `cache.cleanup_interval` | `300` | Interval in seconds to clean up expired entries |
133+
| `cache.cleanup_interval` | `300` | In-memory only. Interval in seconds to clean up expired entries. Not used when `cache.type` is `redis`. |
134+
| `cache.properties[]` | `[]` | Per-cache overrides for `name`, `disabled`, `size`, `ttl`, and `eviction_policy` |
135+
| `cache.redis.address` | `""` | Redis server address in `host:port` format |
136+
| `cache.redis.username` | `""` | Redis username |
137+
| `cache.redis.password` | `""` | Redis password |
138+
| `cache.redis.db` | `0` | Redis database index |
139+
| `cache.redis.key_prefix` | `thunder` | Prefix added to all Redis cache keys |
140+
141+
### Per-Cache Overrides with `cache.properties`
142+
143+
Use `cache.properties` when you want to override cache behavior for a specific internal cache instead of changing the global cache settings for all caches.
144+
145+
Each item in `cache.properties` supports these fields:
146+
147+
| Field | Required | Description |
148+
|---------|---------|-------------|
149+
| `name` | Yes | Internal cache name to override. The value must match the cache name exactly. |
150+
| `disabled` | No | Disables only that cache when set to `true`. |
151+
| `size` | No | Maximum number of entries for that cache. This setting applies to in-memory caches only. |
152+
| `ttl` | No | Time-to-live for that cache in seconds. |
153+
| `eviction_policy` | No | Eviction policy for that cache. Supported values are `LRU` and `LFU`. This setting applies to in-memory caches only. |
154+
155+
If you omit a field in a `cache.properties` entry, Thunder falls back to the corresponding global `cache.*` setting.
156+
157+
That means you can override only the fields you need. Thunder continues to use the global cache settings for any fields you leave unset.
158+
159+
Thunder currently uses cache names such as:
160+
161+
- `ApplicationByIDCache`
162+
- `ApplicationByNameCache`
163+
- `OAuthAppCache`
164+
- `FlowByIDCache`
165+
- `FlowByHandleCache`
166+
- `CertificateByIDCache`
167+
- `CertificateByReferenceCache`
168+
- `UserSchemaByIDCache`
169+
- `UserSchemaByNameCache`
170+
- `FlowGraphCache`
171+
172+
:::note
173+
`FlowGraphCache` is always in-memory. It caches process-local flow graph Go objects during flow execution, not shared system-level cache data.
174+
:::
175+
176+
:::note
177+
When `cache.type` is `redis`, per-cache `ttl` and `disabled` remain useful. Per-cache `size` and `eviction_policy` do not affect Redis behavior because Redis manages memory and eviction independently.
178+
:::
179+
180+
### Redis Cache Configuration
181+
182+
Set `cache.type` to `redis` and configure `cache.redis.address` to enable Redis-backed cache storage.
183+
184+
```yaml
185+
cache:
186+
type: "redis"
187+
ttl: 3600
188+
redis:
189+
address: "localhost:6379"
190+
username: ""
191+
password: ""
192+
db: 0
193+
key_prefix: "thunder"
194+
```
195+
196+
:::note
197+
When Redis caching is enabled, Thunder uses Redis native key expiry for TTL handling.
198+
:::
199+
200+
:::warning
201+
If Thunder cannot connect to Redis during startup, it disables the cache layer.
202+
:::
134203
135204
## JWT Configuration
136205

0 commit comments

Comments
 (0)