redis

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 3 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 {
	Address string
	Auth    string
	DB      int
}

Config contains the configuration for the redis storage

type Provider

type Provider struct {
	Config *Config
	// contains filtered or unexported fields
}

Provider implements a redis-based storage system

func New

func New(c *Config) (*Provider, error)

New returns a new Provider instance

func (*Provider) Exists

func (p *Provider) Exists(alias string) (bool, error)

Exists checks if there is a URL with the requested alias

func (*Provider) Get

func (p *Provider) Get(alias string) (string, error)

Get attempts to find a URL by its alias and returns its original URL

func (*Provider) Init

func (p *Provider) Init() error

Init sets up the Redis pool

func (*Provider) Store

func (p *Provider) Store(url, alias string) error

Store creates a new short URL

Jump to

Keyboard shortcuts

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