Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] interface { Get(ctx context.Context, key string) (T, bool, error) Set(ctx context.Context, key string, value T) error Delete(ctx context.Context, key string) error Purge(ctx context.Context) error }
Cache is a generic cache interface with TTL-based expiration. TTL is configured at construction time, not per-operation.
type Logger ¶
type Logger interface {
Debugw(msg string, keyvals ...any)
Warnw(msg string, keyvals ...any)
Infow(msg string, keyvals ...any)
Errorw(msg string, keyvals ...any)
}
Logger is a structured logging interface compatible with Kratos log.Helper but does not import it.
type Option ¶
type Option func(*config)
Option configures cache construction.
func WithDescription ¶
WithDescription sets the NATS KV bucket description. Ignored for in-memory backend.
func WithLogger ¶
WithLogger sets a structured logger for cache operations.
func WithReconnect ¶
func WithReconnect(ch <-chan struct{}) Option
WithReconnect provides a channel that signals NATS reconnection events.
Click to show internal directories.
Click to hide internal directories.