Skip to content

Add cache.enabled and cache.backend config fields#6585

Open
shuyangli wants to merge 3 commits intomainfrom
sl/add-cache-config
Open

Add cache.enabled and cache.backend config fields#6585
shuyangli wants to merge 3 commits intomainfrom
sl/add-cache-config

Conversation

@shuyangli
Copy link
Member

@shuyangli shuyangli commented Feb 25, 2026

Add InferenceCacheBackend enum (Auto, ClickHouse, Valkey) and new fields to ModelInferenceCacheConfig:

  • enabled: Option<bool> - true requires backend, null uses if available, false disables
  • backend: InferenceCacheBackend - explicit backend selection (default: auto)

Since we're providing an explicit toggle, in Postgres-primary mode we're going to stop trying to fall back to ClickHouse. Users can explicitly specify clickhouse if they want to.

See https://www.notion.so/tensorzerodotcom/Postgres-backed-TensorZero-config-changes-3107520bbad3804d802bc8d265bc361f?source=copy_link.

Benefits #5691. Will need to document the new config changes soon.

Base automatically changed from sl/replace-postgres-feature-flags-with-config to main February 27, 2026 20:47
@shuyangli shuyangli marked this pull request as ready for review February 27, 2026 20:59
Add InferenceCacheBackend enum (Auto, ClickHouse, Valkey) and new fields
to ModelInferenceCacheConfig:
- enabled: Option<bool> - true requires backend, null uses if available, false disables
- backend: InferenceCacheBackend - explicit backend selection (default: auto)

Update CacheManager::new_from_connections to respect these fields.
Add startup validation: cache.enabled=true fails if no backend available.
Update StoredCacheConfig for snapshot backward compatibility.
@shuyangli shuyangli force-pushed the sl/add-cache-config branch 2 times, most recently from 100ae79 to 20dca53 Compare February 27, 2026 21:46
@shuyangli shuyangli force-pushed the sl/add-cache-config branch 3 times, most recently from ed125eb to c3e78f5 Compare February 27, 2026 22:48
@shuyangli shuyangli changed the title M3: Add cache.enabled and cache.backend config fields Add cache.enabled and cache.backend config fields Feb 27, 2026
@shuyangli shuyangli enabled auto-merge February 27, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants