redis

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the Redis client with our specific operations

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient creates a new Redis client with the given configuration

func (*Client) CheckErrorRecoveryTime added in v0.0.21

func (c *Client) CheckErrorRecoveryTime(ctx context.Context, model string) (bool, error)

CheckErrorRecoveryTime checks if a model is still in error recovery period

func (*Client) CheckRecoveryTime

func (c *Client) CheckRecoveryTime(ctx context.Context, model string) (bool, error)

CheckRecoveryTime checks if a model is still in recovery period

func (*Client) CleanupOldErrors added in v0.0.21

func (c *Client) CleanupOldErrors(ctx context.Context, model string, age time.Duration) error

CleanupOldErrors removes error entries older than the specified duration

func (*Client) CleanupOldLatencies

func (c *Client) CleanupOldLatencies(ctx context.Context, model string, age time.Duration) error

CleanupOldLatencies removes latency entries older than the specified duration

func (*Client) ClearAllModelData added in v0.0.21

func (c *Client) ClearAllModelData(ctx context.Context, model string) error

ClearAllModelData deletes all data associated with a model

func (*Client) Close

func (c *Client) Close() error

Close closes the Redis connection

func (*Client) GetAverageLatency

func (c *Client) GetAverageLatency(ctx context.Context, model string, n int64) (float64, error)

GetAverageLatency calculates average latency for last N calls

func (*Client) GetErrorPercentages added in v0.0.21

func (c *Client) GetErrorPercentages(ctx context.Context, model string, n int64) (map[int]float64, error)

GetErrorPercentages calculates the percentage of error codes in the last N calls

func (*Client) GetKeysWithPrefix added in v0.0.23

func (c *Client) GetKeysWithPrefix(ctx context.Context, prefix string) ([]string, error)

GetKeysWithPrefix returns all Redis keys that match the given prefix pattern

func (*Client) GetLatencyEntries

func (c *Client) GetLatencyEntries(ctx context.Context, model string, n int64) ([]float64, error)

GetLatencyEntries retrieves the last N latency entries for a model

func (*Client) RecordErrorCode added in v0.0.21

func (c *Client) RecordErrorCode(ctx context.Context, model string, statusCode int) error

RecordErrorCode records a model's error code with timestamp

func (*Client) RecordLatency

func (c *Client) RecordLatency(ctx context.Context, model string, latency float64, status string) error

RecordLatency records a model's latency with timestamp

func (*Client) SetErrorRecoveryTime added in v0.0.21

func (c *Client) SetErrorRecoveryTime(ctx context.Context, model string, duration time.Duration) error

SetErrorRecoveryTime sets a recovery time for a model with automatic expiration

func (*Client) SetRecoveryTime

func (c *Client) SetRecoveryTime(ctx context.Context, model string, duration time.Duration) error

SetRecoveryTime sets a recovery time for a model with automatic expiration

type Config

type Config struct {
	Addr     string
	Password string
	DB       int
}

Config holds Redis connection configuration

Jump to

Keyboard shortcuts

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