Files

28 lines
1.0 KiB
Go
Raw Permalink Normal View History

2026-05-29 15:58:56 +00:00
// 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)
// launcher.Register(vk) // lifecycle: OnInit → OnStart → OnStop
// health.Register(vk) // health: PING-based, LevelDegraded
//
// # 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