redis

package
v0.0.0-...-d07696b Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Prefix = "go-token"

Variables

View Source
var (
	ErrNotFound     = errors.New("not found")
	ErrInvalidValue = errors.New("invalid value")
)

Functions

This section is empty.

Types

type Redis

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

func NewRedis

func NewRedis(conf *RedisConf, prefix string) (*Redis, error)

func (*Redis) Close

func (r *Redis) Close()

func (*Redis) Del

func (r *Redis) Del(id string) error

Del deletes the token with given id

func (*Redis) Get

func (r *Redis) Get(id string) (string, error)

Get retrieves the token with given id

func (*Redis) GetExpireAt

func (r *Redis) GetExpireAt(id string) (time.Time, error)

GetExpireAt returns expiration time of the token for the given id

func (*Redis) Set

func (r *Redis) Set(id string, token string, expireAt time.Time) error

Set sets the token for the given id and also sets expiration time.

type RedisConf

type RedisConf struct {
	// Host name of the redis server
	Host string

	// Redis server Port
	Port string

	// Redis DB to use
	DB int
}

Jump to

Keyboard shortcuts

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