cache

package
v0.0.0-...-4e1f151 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package cache provides real connection to the cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type URLRedis

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

URLRedis is responsible to connect with Redis. It uses https://github.com/go-redis/redis.

func NewURLRedis

func NewURLRedis(client redis.Cmdable) *URLRedis

NewURLRedis creates an instance URLRedis.

func (*URLRedis) Get

func (ur *URLRedis) Get(ctx context.Context, key string) (*entity.URL, error)

Get gets URL detail from Redis.

func (*URLRedis) IsAlive

func (ur *URLRedis) IsAlive(ctx context.Context) bool

IsAlive must returns true if Redis can connect without any problem. It basically calls PING command.

func (*URLRedis) Save

func (ur *URLRedis) Save(ctx context.Context, url *entity.URL) error

Save saves URL in Redis. It uses hash (https://redis.io/commands/hset).

Jump to

Keyboard shortcuts

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