Valkey (Redis-compatible) client component with launcher lifecycle and health check integration. What's included: - Config with Addrs, Password, SelectDB, CacheSizeEachConn (env-driven) - Provider interface exposing native valkey-go Client() directly (no wrapper) - Component interface: launcher.Component + health.Checkable + Provider - New(logger, cfg) constructor for lifecycle registration via lc.Append - Health check via PING at LevelDegraded priority - Graceful shutdown calling client.Close() in OnStop Tested-via: todo-api POC integration Reviewed-against: docs/adr/
2.1 KiB
2.1 KiB
Changelog
All notable changes to this module will be documented in this file.
The format is based on Keep a Changelog, and this module adheres to Semantic Versioning.
0.9.0 - 2026-03-18
Added
Configstruct — Valkey connection settings loaded from environment variables:VK_ADDRS(required, comma-separated server addresses),VK_PASSWORD(authentication password),VK_DB(database index, default0),VK_CLIENT_CACHE_MB(per-connection client-side cache size in MB, default0disables caching)Providerinterface —Client() valkey.Client; for consumers that only need access to the nativevalkey-goclientComponentinterface — embedslauncher.Component,health.Checkable, andProvider; the full lifecycle-managed surface registered with the launcherNew(logger logz.Logger, cfg Config) Component— constructor; returns aComponentready forlc.AppendOnInit— constructs thevalkey-goclient fromConfig; enables client-side caching whenCacheSizeEachConn > 0OnStart— verifies connectivity by issuing aPINGcommand; returns an error if the ping failsOnStop— callsclient.Close()for graceful shutdownHealthCheck(ctx context.Context) error— issuesPING; returns an error if the client is nil or the command failsName() string— returns"valkey"Priority() health.Level— returnshealth.LevelDegraded; a cache outage degrades service rather than halting it
Design Notes
- The native
valkey-goclient is exposed directly viaClient()with no wrapping or re-exported command subset; callers use the full command-builder API and own all serialisation and key namespacing. Provider/Componentsplit follows the framework pattern: injectProviderinto repositories and services, injectComponentonly at the lifecycle registration site.- Health priority is
LevelDegradedby design — callers must handle cache misses by falling back to the primary datastore rather than treating a Valkey outage as fatal.