redis

package
v0.0.0-...-1f40b3c Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 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 Client

type Client interface {
	SIsMember(string, interface{}) (bool, error)
	SAdd(string, ...interface{}) (int64, error)
	Close() error
	SPop(string) (string, error)
	SRem(string, ...interface{}) (int64, error)
	SMembers(string) ([]string, error)
	ZAdd(key string, members ...redis.Z) (int64, error)
	ZRemRangeByScore(key, min, max string) (int64, error)
	ZCard(key string) (int64, error)
	Expire(key string, expiration time.Duration) (bool, error)
}

Client interface of redis which this application depends on

func NewClient

func NewClient() (Client, error)

NewClient returns an implementation of Client

type Redis

type Redis struct {
	Client *redis.Client
}

Redis implementation of Client

func (*Redis) Close

func (channel *Redis) Close() error

Close closes connection to redis

func (*Redis) Expire

func (channel *Redis) Expire(key string, expiration time.Duration) (bool, error)

Expire sets time to live on a key

func (*Redis) LRange

func (channel *Redis) LRange(key string, start int64, stop int64) ([]string, error)

LRange returns element between start and stop

func (*Redis) SAdd

func (channel *Redis) SAdd(key string, member ...interface{}) (int64, error)

SAdd adds a member to a set

func (*Redis) SIsMember

func (channel *Redis) SIsMember(key string, member interface{}) (bool, error)

SIsMember checks if a a member exists in a set

func (*Redis) SMembers

func (channel *Redis) SMembers(key string) ([]string, error)

SMembers returns members of set

func (*Redis) SPop

func (channel *Redis) SPop(key string) (string, error)

SPop pops an element out of set

func (*Redis) SRem

func (channel *Redis) SRem(key string, members ...interface{}) (int64, error)

SRem remove members from a set

func (*Redis) ZAdd

func (channel *Redis) ZAdd(key string, members ...redis.Z) (int64, error)

ZAdd adds a member to sorted set

func (*Redis) ZCard

func (channel *Redis) ZCard(key string) (int64, error)

ZCard returns cardinal number of a sorted set

func (*Redis) ZRemRangeByScore

func (channel *Redis) ZRemRangeByScore(key, min, max string) (int64, error)

ZRemRangeByScore removes members of a sorted set between min and max scores

Jump to

Keyboard shortcuts

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