yixiuzhemu/dsh-redis-plugin ↗★ 0
dsh-redis-plugin
Redis 连接、查询、分布式锁及模型工具 适合需要在 DSH 中集成 Redis 缓存、队列、分布式锁或提供模型工具的开发者。
安裝
此插件尚未提供可驗證的 bundle,或相容性檢查未通過。請先閱讀倉庫說明。 閱讀完整 README ↗
說明文件
閱讀完整 README ↗Configuration
Config is declared in the plugin's cordis.patch.yml line (or passed to
apply). Every field is optional — a bare - name: dsh-redis-plugin works with
the defaults below. The shipped cordis.patch.yml reads the connection from
REDIS_* environment variables (see Multi-environment)
so no host/port/secret is hardcoded.
- id: redis
name: dsh-redis-plugin
config:
connection:
topology: standalone # standalone | sentinel | cluster (only standalone implemented)
# url wins over host/port/db/password when present:
url: !!js "process.env.REDIS_URL || undefined"
host: !!js "process.env.REDIS_HOST || '127.0.0.1'"
port: !!js "Number(process.env.REDIS_PORT || 6379)"
password: !!js "process.env.REDIS_PASSWORD || undefined"
db: !!js "Number(process.env.REDIS_DB || 0)"
pool:
min: 2
max: 16
idleTimeoutMs: 30000
healthCheckMs: 15000 # 0 disables the PING health check
executor:
coreSize: 8
maxSize: 32
queueCapacity: 1024
keepAliveMs: 60000
timeoutMs: 3000 # per-command timeout
rejectPolicy: abort # abort | discardOldest | callerRuns
retry:
maxAttempts: 3 # idempotent commands only
backoffMs: 200
codec:
keyPrefix: '' # optional namespace prefix for all keys
value: json # json | string | raw
typeHint: false # embed @type for Date/Map/Set/Buffer round-trips
offloadThresholdBytes: 1048576
lock:
defaultTtlMs: 30000
watchdogIntervalMs: 1000
renewAheadMs: 10000 # renew when < this much TTL remains
releaseOnDispose: false # true = actively release locks on shutdown
tools:
enabled: true # register model-visible tools
allowDestructive: false # gate redis_del behind pre-execute permission
Multi-environment (dev / test / uat / prod)
The connection is environment-driven: cordis.patch.yml resolves each field
from a REDIS_* env var (via the loader's !!js tag), so you switch stages by
injecting different values — never by editing code. Copy .env.example
to .env (git-ignored) or set the vars in your deployment pipeline.
| Variable | Purpose | Default |
|---|---|---|
REDIS_ENV | Stage label (dev/test/uat/prod); logged at startup, unknown values warn. Does not itself change the address. | default |
REDIS_URL | Full connection URL. If set, wins over host/port/db/password. | (unset) |
REDIS_HOST / REDIS_PORT | Discrete address. | 127.0.0.1 / 6379 |
REDIS_PASSWORD / REDIS_DB | Auth + logical DB. | (none) / 0 |
REDIS_KEY_PREFIX | Optional key namespace — recommended when stages share one Redis so keys never collide. | (none) |
Precedence: REDIS_URL → REDIS_HOST/PORT/PASSWORD/DB → built-in default
(127.0.0.1:6379/0). Each stage simply exports its own values, e.g.: