cacheredis

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cacheredis provides a supported Redis-backed cache adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthChecker

func HealthChecker(client redis.UniversalClient) ports.HealthChecker

HealthChecker returns a Redis cache dependency health checker.

Types

type Options

type Options struct {
	KeyPrefix  string
	DefaultTTL time.Duration
}

Options configures a Redis-backed cache store.

type Store

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

Store implements cache.Store using Redis.

func New

func New(client redis.UniversalClient, opts Options) *Store

New constructs a Redis-backed cache store.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

Delete removes a cached value.

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, bool, error)

Get returns a cached value if present.

func (*Store) HealthChecker

func (s *Store) HealthChecker() ports.HealthChecker

HealthChecker returns a Redis cache dependency health checker for this store.

func (*Store) Set

func (s *Store) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error

Set writes a cached value. When ttl is zero or negative, DefaultTTL is used.

Jump to

Keyboard shortcuts

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