redis

package
v0.0.0-...-47a55c7 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

Config конфигурация для Redis

type Redis

type Redis[T any] struct {
	// contains filtered or unexported fields
}

Redis реализация кеша с Redis

func New

func New[T any](cfg *Config) *Redis[T]

New создает новый экземпляр Redis

func (*Redis[T]) Delete

func (cache *Redis[T]) Delete(ctx context.Context, key string) error

Delete удаляет значение из кеша

func (*Redis[T]) Get

func (cache *Redis[T]) Get(ctx context.Context, key string) (T, error)

Get возвращает значение из кеша

func (*Redis[T]) Set

func (cache *Redis[T]) Set(ctx context.Context, key string, value T) error

Set добавляет значение в кеш

Jump to

Keyboard shortcuts

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