redisguard

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package redisguard fails Redis commands fast while Redis is unreachable. Per-command timeouts alone multiply: one request runs a dozen commands, so a blackholed Redis would still cost it seconds before every limit fails open.

Index

Constants

This section is empty.

Variables

View Source
var ErrOpen = errors.New("redis unavailable (guard open)")

ErrOpen is returned without network IO while the guard is open.

Functions

func Log

func Log(err error) *zerolog.Event

Log picks the level for a failed Redis call: once the guard is open the outage was logged when it opened, so each fast-failed call is only Debug.

Types

type Guard

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

Guard is a go-redis hook shared by every user of the client: throttles, caches and the node pool all see the same open/closed state.

func New

func New() *Guard

func (*Guard) DialHook

func (g *Guard) DialHook(next redis.DialHook) redis.DialHook

DialHook passes dials through: they happen inside admitted commands, whose outcome is already reported, and a probe must be able to reconnect.

func (*Guard) Open

func (g *Guard) Open() bool

Open reports whether commands are currently refused.

func (*Guard) ProcessHook

func (g *Guard) ProcessHook(next redis.ProcessHook) redis.ProcessHook

func (*Guard) ProcessPipelineHook

func (g *Guard) ProcessPipelineHook(next redis.ProcessPipelineHook) redis.ProcessPipelineHook

Jump to

Keyboard shortcuts

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