state

package
v0.0.0-...-07d62d3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvRedisAddr to use when connecting to Redis
	EnvRedisAddr = `FLU_REDIS_ADDR`

	// EnvRedisPassword to use when authenticating to the Redis server
	EnvRedisPassword = `FLU_REDIS_PASSWORD`

	// Context to use when writing logging messages
	Context = `REDIS`
)

Variables

This section is empty.

Functions

func Del

func Del(keys ...string)

Delete zero or more key-value pairs

func Expire

func Expire(key string, seconds int64)

Expire sets the expiration time of a key.

func Get

func Get(key string) []byte

Get state using the key

func GetSet

func GetSet(key string, content interface{}) []byte

func Incr

func Incr(key string) int64

Incr increments the value of a key by 1 atomically.

func LLen

func LLen(key string) int64

LLen is the length of the list at key

func LPopCount

func LPopCount(key string, count int) [][]byte

func LPush

func LPush(key string, content interface{})

func LRange

func LRange(key string, start, end int64) [][]byte

func Leaky

func Leaky() *redis.Client

Leaky access to the underlying Redis handle. Be careful!

func Lpop

func Lpop(key string) []byte

Lpop something from the Redis, returning an empty byte slice if empty.

func NewRedsync

func NewRedsync() *redsync.Redsync

returns a redsync distributed mutex on top of redis client

func RPopCount

func RPopCount(key string, count int) [][]byte

func RPush

func RPush(key string, content interface{})

func Rpop

func Rpop(key string) []byte

Rpop something from the Redis, returning an empty byte slice if empty.

func Rpush

func Rpush(key string, value interface{}) int64

Rpush a value into a key, returning the new length.

func Set

func Set(key string, content interface{})

Set state to the key containing the JSON-encoded content

func SetNxTimed

func SetNxTimed(key string, content interface{}, expiry time.Duration) (didSet bool)

SetNxTimed, returning didSet as true if the value was set (didn't exist already!)

func SetTimed

func SetTimed(key string, seconds uint64, content interface{})

SetTimed state to the key containing JSON-encoded content, deleting after the time period defined as a constant in state.

func SetTimedIfSet

func SetTimedIfSet(name string, value interface{}) (set bool)

SetTimed attempts to set a cookie with the JSON of value if the key is already set and not empty.

func ZAdd

func ZAdd(key string, content *redis.Z)

func ZAddSelfScore

func ZAddSelfScore(key string, content float64)

func ZExists

func ZExists(key, member string) bool

func ZPeep

func ZPeep(key string) (string, bool)

ZPeep looks at the first member of a sorted set without popping it returning it and a boolean of whether there was an element or not

func ZRem

func ZRem(key, member string)

func ZRemRangeByRank

func ZRemRangeByRank(key string, start, stop int64)

func ZScore

func ZScore(key, member string) float64

Types

This section is empty.

Jump to

Keyboard shortcuts

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