* fix(parser): let UnmarshalJson return slice payloads
validator.Struct rejects any non-struct top-level value, so UnmarshalJson
with a slice T always failed before returning. Skip validation for slices
alongside maps and strings.
UnmarshalJsonBytes2Slice remains the variant that validates per element.
* feat(cache): cache tenant model installations in the daemon
Dify caches the per-tenant model provider list, but enterprise installs
plugins through the daemon directly, so Dify never learns its cache is
stale and a newly assigned plugin stays invisible until the TTL expires.
Move the cache to where the writes happen. ListModels now reads through a
Redis hash keyed per tenant, with the page as the field so a single DEL
drops every cached page, and InstallPlugin/UninstallPlugin/UpgradePlugin
invalidate it.
The invalidation is deferred rather than run after the transaction: a
retried install aborts on ErrPluginAlreadyInstalled before reaching any
post-transaction code, so a DEL placed there is unreachable once it has
failed once.
TTL defaults to 60 minutes, configurable via
PLUGIN_MODEL_INSTALLATIONS_CACHE_TTL.
* Update PLUGIN_MODEL_INSTALLATIONS_CACHE_TTL value
* Increase PluginModelInstallationsCacheTTL to 1440
* feat(cache): put the model installations cache behind a switch, off by default
The daemon cache holds the same tenant payload dify already caches, so leaving
both on doubles the redis footprint and forces a scale-up before a cloud
production rollout. PLUGIN_MODEL_INSTALLATIONS_CACHE_ENABLED defaults to false;
enable it only where dify runs with PLUGIN_MODEL_PROVIDERS_CACHE_ENABLED=false.
* feat(redis): add Redis Cluster client path to plugin-daemon
Wire the missing third branch so operators can point the daemon at a
Redis Cluster without falling back to dialing an empty REDIS_HOST:PORT
and panicking at startup.
* introduce REDIS_USE_CLUSTERS / REDIS_CLUSTERS /
REDIS_CLUSTERS_PASSWORD envs, aligned with dify api naming so Helm
can set a single env group
* branch in PluginManager.Launch for Cluster ahead of the existing
Sentinel / standalone paths; falls back to REDIS_PASSWORD if the
cluster-specific password is not set
* implement cache.InitRedisClusterClient via redis.NewClusterClient;
downstream cache / lock / pub-sub helpers keep working because
`client` is declared as redis.UniversalClient
Redis Cluster disables SELECT DB, so the cluster branch does not
plumb RedisDB. This is intentional and documented in the release
note accompanying the overall Redis Cluster support work.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(redis): validate Redis cluster addresses and improve transaction handling
* feat(redis): implement CSV parsing utility and refactor Redis transaction handling
* feat(redis): scope plugin-daemon to standalone + sentinel only
Narrow the plugin-daemon Redis client to standalone and sentinel modes;
remove the cluster code paths that were briefly exercised on this branch.
Changes:
- Remove REDIS_USE_CLUSTERS / REDIS_CLUSTERS / REDIS_CLUSTERS_PASSWORD
env fields from app.Config.
- Remove the cluster branch (plus the two cluster-specific fail-fast
guards on REDIS_USE_CLUSTERS + REDIS_USE_SENTINEL and REDIS_DB != 0)
from PluginManager.Launch. The init block is now just sentinel or
standalone.
- Delete cache.InitRedisClusterClient. The main redis client + all
helpers (Transaction, pub/sub, lock, etc.) already route through
redis.UniversalClient so downstream code needs no adjustment.
Intentionally kept:
- Transaction(fn, watchKeys...) signature: the variadic signature is
backwards-compatible with every existing Transaction(fn) call and the
one new-style caller (debugging_service) benefits from real WATCH
semantics even on standalone — this is correctness-independent of
cluster support.
- parser.SplitAndTrimCSV: the sentinel branch migrated to it in 617e7a5f
and still uses it to parse REDIS_SENTINELS, so the helper has a
standalone/sentinel consumer and stays.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>