redis

package
v0.0.0-...-70d632b Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(cfg *Config) *redis.Client

NewClient создание клиента для подключения к redis.

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](client *redis.Client) *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