shortener

package
v0.0.0-...-264aa39 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheShortener

type CacheShortener struct {
	Shortener
	// contains filtered or unexported fields
}

CacheShortener implements Shortener backed by go-cache

func InitCacheShortener

func InitCacheShortener(config *config.Configuration) *CacheShortener

InitCacheShortener takes a configuration and returns a new CacheShortener

func (*CacheShortener) Get

func (c *CacheShortener) Get(key string) *model.Link

Get gets a link from the cache given a key

func (*CacheShortener) Put

func (c *CacheShortener) Put(link *model.Link) error

Put puts a link in the cache

type Shortener

type Shortener interface {
	// Gets a link given a key, returns nil or a valid link
	Get(key string) *model.Link

	// Puts a link
	// returns error if link is invalid or already present
	Put(link *model.Link) error
}

Shortener defines Get and Put operations

Jump to

Keyboard shortcuts

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