meshRedis

package module
v0.0.0-...-9c0ff2d Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: MIT Imports: 6 Imported by: 1

README

MeshRedis

MeshRedis is a more strongly typed wrapper around RediGo.

Status

This project is only opensourced currently to support a dependency from another project. Better readme to follow shortly...

Build Status

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClosePool

func ClosePool() error

ClosePool kills the entire connection pool to redis

func SetupRedis

func SetupRedis() error

SetupRedis establishes a connection to the Redis instance at the provided url. If the connection attempt is unsuccessful, an error object will be returned describing the failure.

@param url: The URL address to which the connection will be established. EX: redis://127.0.0.1:6379/200

NOTE: the path '200' specifies the DB ID number. Use this to create seperate instances

func UnderlyingPool

func UnderlyingPool() *redis.Pool

UnderlyingPool exposes a reference to the underlying pool

Types

type RedPool

type RedPool interface {
	Get() redis.Conn
}

RedPool is a interface for struct that can vend a connection to a redigo connection

type RedisSession

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

RedisSession models a connection to an underlying NoSQL persistence store.

func NewSession

func NewSession() *RedisSession

NewSession issues a new meshRedis ResisSession. This will be the interface that will be used to perform actions on redis

func NewSessionWithExistingPool

func NewSessionWithExistingPool(poolVendor RedPool) *RedisSession

NewSessionWithExistingPool is a convenience for using MeshRedis with a pool managed by another source

func (*RedisSession) AtomicPushOnListWithMsExpiration

func (s *RedisSession) AtomicPushOnListWithMsExpiration(key string, value string, msToExpire int64) error

AtomicPushOnListWithMsExpiration pushes a token, and key to a list with expiration of the list in terms of Milliseconds

func (*RedisSession) CloseSession

func (s *RedisSession) CloseSession() error

CloseSession kills the RedisSession instance

func (*RedisSession) Delete

func (s *RedisSession) Delete(key string) error

Delete removes a key from redis

func (*RedisSession) FlushAllKeys

func (s *RedisSession) FlushAllKeys() error

FlushAllKeys wipes out all keys in the current redis DB

func (*RedisSession) GetInt

func (s *RedisSession) GetInt(key string) (value int, err error)

GetInt retreives the value from the store.

func (*RedisSession) GetListCount

func (s *RedisSession) GetListCount(key string) (count int, err error)

GetListCount returns the count of the list for the given key. If none exists, it returns 0

func (*RedisSession) GetString

func (s *RedisSession) GetString(key string) (value string, err error)

GetString retreives the value from the store.

func (*RedisSession) KeyExists

func (s *RedisSession) KeyExists(key string) (bool, error)

KeyExists checks if a given key exits in redis

func (*RedisSession) PTTLForKey

func (s *RedisSession) PTTLForKey(key string) (int, error)

PTTLForKey returns the lifetime of the value associated with the key in ms If no key is found, the `error` return value will be non-nil

func (*RedisSession) Ping

func (s *RedisSession) Ping() error

Ping is used internally to ping the connection

func (*RedisSession) RPush

func (s *RedisSession) RPush(key string, value string) (count int, err error)

RPush appends a list in redis with the key

func (*RedisSession) RPushX

func (s *RedisSession) RPushX(key string, value string) (count int, err error)

RPushX appends a list in redis with the key if it exists

func (*RedisSession) SetInt

func (s *RedisSession) SetInt(key string, value int) error

SetInt assigns the int to the supplied key in redis

func (*RedisSession) SetIntWithExpiration

func (s *RedisSession) SetIntWithExpiration(key string, seconds int, value int) error

SetIntWithExpiration assigns the int to the supplied key in redis

func (*RedisSession) SetString

func (s *RedisSession) SetString(key string, value string) error

SetString assigns the string to the supplied key in redis

func (*RedisSession) SetStringWithExpiration

func (s *RedisSession) SetStringWithExpiration(key string, seconds int, value string) error

SetStringWithExpiration assigns the int to the supplied key in redis

func (*RedisSession) UpdateExpirationOfKey

func (s *RedisSession) UpdateExpirationOfKey(key string, seconds int) error

UpdateExpirationOfKey updates the expiration value of a key in redis If no key is found, the `error` return value will be non-nil

Jump to

Keyboard shortcuts

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