sloghook

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sloghook provides a slog-based implementation of cascache.Hooks. It is optional: the core cascache package has no logging dependency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

Hooks is a slog-backed implementation of cascache.Hooks.

func New

func New(l *slog.Logger, opts Options) *Hooks

New creates a slog-based Hooks.

func (*Hooks) BulkRejected

func (h *Hooks) BulkRejected(ns string, requested int, reason cascache.BulkRejectReason)

func (*Hooks) GenBumpError

func (h *Hooks) GenBumpError(cacheKey genstore.CacheKey, err error)

func (*Hooks) GenSnapshotError

func (h *Hooks) GenSnapshotError(count int, err error)

func (*Hooks) InvalidateOutage

func (h *Hooks) InvalidateOutage(key string, bumpErr, delErr error)

func (*Hooks) LocalGenWithBulk

func (h *Hooks) LocalGenWithBulk()

func (*Hooks) ProviderSetRejected

func (h *Hooks) ProviderSetRejected(storageKey string, isBulk bool)

func (*Hooks) SelfHealSingle

func (h *Hooks) SelfHealSingle(storageKey string, reason cascache.SelfHealReason)

type Options

type Options struct {
	// Sampling to avoid log floods; 0 or 1 = log every event.
	SelfHealEvery   uint64
	BulkRejectEvery uint64

	// Optional key redactor. If nil, a short SHA-256 prefix is used.
	Redact func(string) string
}

Options configures the slog-based Hooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL