storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 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 Redis

type Redis struct {
	Host             string
	Port             int
	Password         string
	DB               int
	IdleTimeout      int
	MaxIdleConns     int
	MaxOpenConns     int
	InitialOpenConns int
}

Redis struct

type RedisInterface

type RedisInterface interface {
	StoreLongUrl2Redis(url string) string
	GetShortUrlFromRedis(key uint64) string
}

RedisInterface define data interface

var RedisPool RedisInterface

RedisPool declare

func NewRedis

func NewRedis(config Redis) (RedisInterface, error)

NewRedis generate redis instance

type RedisStorage

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

RedisStorage represents redis pool

func (*RedisStorage) GetShortUrlFromRedis

func (r *RedisStorage) GetShortUrlFromRedis(key uint64) string

GetShortUrlFromRedis acquire a long url with the short one

func (*RedisStorage) StoreLongUrl2Redis

func (r *RedisStorage) StoreLongUrl2Redis(url string) string

StoreLongUrl2Redis store a long url to redis server

Jump to

Keyboard shortcuts

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