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.
29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
// Package cachevalkey provides a lifecycle-aware Valkey client with health checks
|
|
// and three adapters that integrate with other Einherjar starters via duck typing.
|
|
//
|
|
// # Quick start
|
|
//
|
|
// vk := cachevalkey.New(logger, cfg)
|
|
// lc.Append(vk) // lifecycle: OnInit → OnStart → OnStop
|
|
// // vk satisfies observability.Checkable (PING-based, LevelDegraded) — wire a health endpoint:
|
|
// srv.Get("/health", health.NewHandler(logger, vk).ServeHTTP)
|
|
//
|
|
// # Adapters
|
|
//
|
|
// Each adapter wraps the Provider and satisfies one interface in another module.
|
|
// Go's structural typing handles the assignment — no cast required:
|
|
//
|
|
// permCache := cachevalkey.NewPermissionCache(vk) // → auth/rbac.Cache
|
|
// rateLimiter := cachevalkey.NewRateLimiterStore(vk, time.Second, 100) // → web/mw.RateLimiterStore
|
|
// blacklist := cachevalkey.NewBlacklist(vk) // → auth-jwt.Blacklist
|
|
//
|
|
// # Configuration
|
|
//
|
|
// Config fields carry caarlos0/env struct tags. Populate via environment variables
|
|
// or construct directly:
|
|
//
|
|
// cfg := cachevalkey.Config{
|
|
// Addrs: []string{"localhost:6379"},
|
|
// }
|
|
package cachevalkey
|