storage

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalMemoryStorage

type LocalMemoryStorage struct {
	sync.RWMutex
	Store map[string]string
}

func (*LocalMemoryStorage) Contains

func (s *LocalMemoryStorage) Contains(short string) bool

func (*LocalMemoryStorage) Get

func (s *LocalMemoryStorage) Get(short string) (string, error)

func (*LocalMemoryStorage) Save

func (s *LocalMemoryStorage) Save(short, origin string, _ time.Duration)

type RedisStorage

type RedisStorage struct {
	Client     *redis.Client
	Context    context.Context
	Expiration time.Duration
}

func (*RedisStorage) Contains

func (s *RedisStorage) Contains(short string) bool

func (*RedisStorage) Get

func (s *RedisStorage) Get(short string) (val string, err error)

func (*RedisStorage) Save

func (s *RedisStorage) Save(short, origin string, expirationInHours time.Duration)

type Storage

type Storage interface {
	Contains(short string) bool
	Save(short, origin string, expirationInHours time.Duration)
	Get(short string) (string, error)
}

Jump to

Keyboard shortcuts

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