docs(cache-valkey): fix fictional launcher.Register/health.Register in doc examples
The package-doc examples showed a fictional launcher.Register / health.Register API (and launcher.Append as a package func). Corrected to the real wiring: lc.Append + web/health.NewHandler(...).ServeHTTP. (component.go doc comment corrected too.) Documentation-only. No code, API, or dependency changes; version stays v1.1.0 (the v1.1.0 tag is moved to include this fix). Verified by compiling the corrected pattern against the real API.
This commit is contained in:
@@ -17,8 +17,9 @@ import cachevalkey "code.nochebuena.dev/einherjar/cache-valkey"
|
||||
vk := cachevalkey.New(logger, cachevalkey.Config{
|
||||
Addrs: []string{"localhost:6379"},
|
||||
})
|
||||
launcher.Register(vk) // OnInit → OnStart → OnStop
|
||||
health.Register(vk) // PING-based health check, LevelDegraded
|
||||
lc.Append(vk) // OnInit → OnStart → OnStop
|
||||
// vk is observability.Checkable (PING-based, LevelDegraded):
|
||||
srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP)
|
||||
```
|
||||
|
||||
## Connecting to other modules
|
||||
@@ -30,8 +31,8 @@ them directly to the consuming modules:
|
||||
```go
|
||||
// --- 1. Create the component (lifecycle + health + Provider) ---
|
||||
vk := cachevalkey.New(logger, cfg)
|
||||
launcher.Register(vk)
|
||||
health.Register(vk)
|
||||
lc.Append(vk)
|
||||
srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP)
|
||||
|
||||
// --- 2. Create adapters (one per consumer interface) ---
|
||||
// Each adapter wraps vk (a Provider) and satisfies one interface in another module.
|
||||
|
||||
Reference in New Issue
Block a user