Files
cache-valkey/doc.go
T

29 lines
1.1 KiB
Go
Raw Permalink Normal View History

// 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