Documentation ¶
Index ¶
- Variables
- func Delete(key string)
- func DeleteAll(key string)
- func Dequeue(queueName string, value interface{})
- func Enqueue(queueName string, value interface{})
- func Get(key string, value interface{}) bool
- func Initialize(mode, redisHost, redisPassword string, TTL int)
- func Key(args ...string) string
- func Set(key string, value interface{})
- func SetWithTTL(key string, value interface{}, ttl int)
- type LocalStore
- func (s *LocalStore) Delete(key string)
- func (s *LocalStore) DeleteAll(key string)
- func (s *LocalStore) Dequeue(queueName string, value interface{})
- func (s *LocalStore) Enqueue(queueName string, value interface{})
- func (s *LocalStore) Get(key string, value interface{}) bool
- func (s *LocalStore) Set(key string, value interface{})
- func (s *LocalStore) SetWithTTL(key string, value interface{}, ttl int)
- 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) Enqueue(queueName string, value interface{})
- func (s *RedisStore) Get(key string, value interface{}) bool
- func (s *RedisStore) Set(key string, value interface{})
- func (s *RedisStore) SetWithTTL(key string, value interface{}, ttl int)
- type Store
Constants ¶
This section is empty.
Variables ¶
var Status string
Status : local ok redis
Functions ¶
func Dequeue ¶
func Dequeue(queueName string, value interface{})
Dequeue gets from queue This is blocking while there is nothing in the queue
func Initialize ¶
Initialize the global cache in memory, or redis
func SetWithTTL ¶
SetWithTTL something in the cache with a specific TTL.
Types ¶
type LocalStore ¶
type LocalStore struct { Mutex *sync.Mutex Data map[string][]byte Queues map[string]*list.List TTL int }
LocalStore is a in memory cache for dev purpose only
func (*LocalStore) DeleteAll ¶
func (s *LocalStore) DeleteAll(key string)
DeleteAll on locastore delete all the things
func (*LocalStore) Dequeue ¶
func (s *LocalStore) Dequeue(queueName string, value interface{})
Dequeue gets from queue This is blocking while there is nothing in the queue
func (*LocalStore) Enqueue ¶
func (s *LocalStore) Enqueue(queueName string, value interface{})
Enqueue pushes to queue
func (*LocalStore) Get ¶
func (s *LocalStore) Get(key string, value interface{}) bool
Get a key from local store
func (*LocalStore) Set ¶
func (s *LocalStore) Set(key string, value interface{})
Set a value in local store
func (*LocalStore) SetWithTTL ¶
func (s *LocalStore) SetWithTTL(key string, value interface{}, ttl int)
SetWithTTL a value in local store with a specific ttl (in seconds): (0 for eternity)
type RedisStore ¶
type RedisStore struct { Client redisClient // contains filtered or unexported fields }
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) 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) Set ¶
func (s *RedisStore) Set(key string, value interface{})
Set a value in redis
func (*RedisStore) SetWithTTL ¶
func (s *RedisStore) SetWithTTL(key string, value interface{}, ttl int)
SetWithTTL a value in local store (0 for eternity)
type Store ¶
type Store interface { Get(key string, value interface{}) bool Set(key string, value interface{}) SetWithTTL(key string, value interface{}, ttl int) Delete(key string) DeleteAll(key string) Enqueue(queueName string, value interface{}) Dequeue(queueName string, value interface{}) }
Store is an interface