Documentation
¶
Index ¶
- func ClosePool() error
- func SetupRedis() error
- func UnderlyingPool() *redis.Pool
- type RedPool
- type RedisSession
- func (s *RedisSession) AtomicPushOnListWithMsExpiration(key string, value string, msToExpire int64) error
- func (s *RedisSession) CloseSession() error
- func (s *RedisSession) Delete(key string) error
- func (s *RedisSession) FlushAllKeys() error
- func (s *RedisSession) GetInt(key string) (value int, err error)
- func (s *RedisSession) GetListCount(key string) (count int, err error)
- func (s *RedisSession) GetString(key string) (value string, err error)
- func (s *RedisSession) KeyExists(key string) (bool, error)
- func (s *RedisSession) PTTLForKey(key string) (int, error)
- func (s *RedisSession) Ping() error
- func (s *RedisSession) RPush(key string, value string) (count int, err error)
- func (s *RedisSession) RPushX(key string, value string) (count int, err error)
- func (s *RedisSession) SetInt(key string, value int) error
- func (s *RedisSession) SetIntWithExpiration(key string, seconds int, value int) error
- func (s *RedisSession) SetString(key string, value string) error
- func (s *RedisSession) SetStringWithExpiration(key string, seconds int, value string) error
- func (s *RedisSession) UpdateExpirationOfKey(key string, seconds int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
UnderlyingPool exposes a reference to the underlying pool
Types ¶
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