redisring

package
Version: v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine uses redis.v4 as the back end

func NewRedisRingStore

func NewRedisRingStore(
	prefix string,
	ring *redis.Ring,
	cleanupTimeout time.Duration,
) (*Engine, error)

NewRedisRingStore creates a new redis ring for use as a store

func (*Engine) Exists

func (e *Engine) Exists(key string) bool

Exists checks to see if a key exists in the store

func (*Engine) Expire

func (e *Engine) Expire(key string) error

Expire marks the key as expired and removes it from the storage engine

func (*Engine) Get

func (e *Engine) Get(key string) ([]byte, error)

Get retrieves data from teh store based on the key if it exists, returns an error if the key does not exist or the redis connection fails

func (*Engine) IsExpired

func (e *Engine) IsExpired(key string) bool

IsExpired checks to see if the given key has expired

func (*Engine) IsLocked

func (e *Engine) IsLocked(key string) bool

IsLocked checks to see if the key has been locked

func (*Engine) Lock

func (e *Engine) Lock(key string) error

Lock sets a lock against a given key SETEX doesn't exist within this lib, it's advised to use Set for similar behavior https://github.com/go-redis/redis/blob/dc9d5006b3c319de24b2fa4de242e442553fcce2/commands.go#L726

func (*Engine) Put

func (e *Engine) Put(key string, data []byte, expires time.Time) error

Put stores data against a key, else it returns an error SETEX doesn't exist within this lib, it's advised to use Set for similar behavior https://github.com/go-redis/redis/blob/dc9d5006b3c319de24b2fa4de242e442553fcce2/commands.go#L726

func (*Engine) Unlock

func (e *Engine) Unlock(key string) error

Unlock removes the lock from a given key

Source Files

Jump to

Keyboard shortcuts

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