Documentation
¶
Index ¶
- func Key(args ...string) string
- func NewWriteCloser(store Store, key string, ttl int) io.WriteCloser
- type PubSub
- type RedisStore
- func (s *RedisStore) Delete(key string)
- func (s *RedisStore) DeleteAll(pattern string)
- func (s *RedisStore) Dequeue(queueName string, value interface{})
- func (s *RedisStore) DequeueWithContext(c context.Context, queueName string, value interface{})
- func (s *RedisStore) Enqueue(queueName string, value interface{})
- func (s *RedisStore) Get(key string, value interface{}) bool
- func (s *RedisStore) GetMessageFromSubscription(c context.Context, pb PubSub) (string, error)
- func (s *RedisStore) Lock(key string, expiration time.Duration, retrywdMillisecond int, retryCount int) bool
- func (s *RedisStore) Publish(channel string, value interface{})
- func (s *RedisStore) QueueLen(queueName string) int
- func (s *RedisStore) RemoveFromQueue(rootKey string, memberKey string)
- func (s *RedisStore) Set(key string, value interface{})
- func (s *RedisStore) SetAdd(rootKey string, memberKey string, member interface{})
- func (s *RedisStore) SetCard(key string) int
- func (s *RedisStore) SetRemove(rootKey string, memberKey string, member interface{})
- func (s *RedisStore) SetScan(key string, members ...interface{}) error
- func (s *RedisStore) SetWithTTL(key string, value interface{}, ttl int)
- func (s *RedisStore) Status() sdk.MonitoringStatusLine
- func (s *RedisStore) Subscribe(channel string) PubSub
- func (s *RedisStore) Unlock(key string)
- func (s *RedisStore) UpdateTTL(key string, ttl int)
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWriteCloser ¶
func NewWriteCloser(store Store, key string, ttl int) io.WriteCloser
NewWriteCloser returns a write closer
Types ¶
type RedisStore ¶
RedisStore a redis client and a default ttl
func NewRedisStore ¶
func NewRedisStore(host, password string, ttl int) (*RedisStore, error)
NewRedisStore initiate a new redisStore
func (*RedisStore) DeleteAll ¶
func (s *RedisStore) DeleteAll(pattern string)
DeleteAll delete all mathing keys in redis
func (*RedisStore) Dequeue ¶
func (s *RedisStore) Dequeue(queueName string, value interface{})
Dequeue gets from queue This is blocking while there is nothing in the queue
func (*RedisStore) DequeueWithContext ¶
func (s *RedisStore) DequeueWithContext(c context.Context, queueName string, value interface{})
DequeueWithContext gets from queue This is blocking while there is nothing in the queue, it can be cancelled with a context.Context
func (*RedisStore) Enqueue ¶
func (s *RedisStore) Enqueue(queueName string, value interface{})
Enqueue pushes to queue
func (*RedisStore) Get ¶
func (s *RedisStore) Get(key string, value interface{}) bool
Get a key from redis
func (*RedisStore) GetMessageFromSubscription ¶
GetMessageFromSubscription from a redis PubSub
func (*RedisStore) Publish ¶
func (s *RedisStore) Publish(channel string, value interface{})
Publish a msg in a channel
func (*RedisStore) QueueLen ¶
func (s *RedisStore) QueueLen(queueName string) int
QueueLen returns the length of a queue
func (*RedisStore) RemoveFromQueue ¶
func (s *RedisStore) RemoveFromQueue(rootKey string, memberKey string)
RemoveFromQueue removes a member from a list
func (*RedisStore) Set ¶
func (s *RedisStore) Set(key string, value interface{})
Set a value in redis
func (*RedisStore) SetAdd ¶
func (s *RedisStore) SetAdd(rootKey string, memberKey string, member interface{})
SetAdd add a member (identified by a key) in the cached set
func (*RedisStore) SetCard ¶
func (s *RedisStore) SetCard(key string) int
SetCard returns the cardinality of a ZSet
func (*RedisStore) SetRemove ¶
func (s *RedisStore) SetRemove(rootKey string, memberKey string, member interface{})
SetRemove removes a member from a set
func (*RedisStore) SetScan ¶
func (s *RedisStore) SetScan(key string, members ...interface{}) error
SetScan scans a ZSet
func (*RedisStore) SetWithTTL ¶
func (s *RedisStore) SetWithTTL(key string, value interface{}, ttl int)
SetWithTTL a value in local store (0 for eternity)
func (*RedisStore) Status ¶
func (s *RedisStore) Status() sdk.MonitoringStatusLine
Status returns the status of the local cache
func (*RedisStore) Subscribe ¶
func (s *RedisStore) Subscribe(channel string) PubSub
Subscribe to a channel
func (*RedisStore) Unlock ¶
func (s *RedisStore) Unlock(key string)
func (*RedisStore) UpdateTTL ¶
func (s *RedisStore) UpdateTTL(key string, ttl int)
UpdateTTL update the ttl linked to the key
type Store ¶
type Store interface {
Get(key string, value interface{}) bool
Set(key string, value interface{})
SetWithTTL(key string, value interface{}, ttl int)
UpdateTTL(key string, ttl int)
Delete(key string)
DeleteAll(key string)
Enqueue(queueName string, value interface{})
Dequeue(queueName string, value interface{})
DequeueWithContext(c context.Context, queueName string, value interface{})
QueueLen(queueName string) int
RemoveFromQueue(queueName string, memberKey string)
Publish(queueName string, value interface{})
Subscribe(queueName string) PubSub
GetMessageFromSubscription(c context.Context, pb PubSub) (string, error)
Status() sdk.MonitoringStatusLine
SetAdd(rootKey string, memberKey string, member interface{})
SetRemove(rootKey string, memberKey string, member interface{})
SetCard(key string) int
SetScan(key string, members ...interface{}) error
Lock(key string, expiration time.Duration, retryWaitDurationMillisecond int, retryCount int) bool
Unlock(key string)
}
Store is an interface