Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
RedisClient // interface for accessing underlying redis client
}
Cache is a wrapper for cache accesses.
func NewCache ¶
func NewCache(r RedisClient) *Cache
NewCache creates a Cache wrapper with underlying redis client assigned.
func (*Cache) IsTypeMtimeUpdated ¶
func (c *Cache) IsTypeMtimeUpdated(ctx context.Context, clientID string, dataType int, token int64) bool
IsTypeMtimeUpdated check the cache to determine if there might be updates for a specific type for a client. It gets the last seen mtime for clientID#dataType in the cache, return false if it is found and the value is older or equal to client's token, which means the client is already up-to-date. In any other cases, it will return false.
type RedisClient ¶
type RedisClient interface { Set(ctx context.Context, key string, val string, ttl time.Duration) error Get(ctx context.Context, key string) (string, error) FlushAll(ctx context.Context) error }
RedisClient is a wrapper to support clients for standalone redis and redis cluster.
func NewRedisClient ¶
func NewRedisClient() RedisClient
NewRedisClient create a client for standalone redis or redis cluster.
type RedisClientWithPrometheus ¶
type RedisClientWithPrometheus struct {
// contains filtered or unexported fields
}
RedisClientWithPrometheus implements RedisClient interface with all methods wrapped with Prometheus metrics
func NewRedisClientWithPrometheus ¶
func NewRedisClientWithPrometheus(base RedisClient, instanceName string) RedisClientWithPrometheus
NewRedisClientWithPrometheus returns an instance of the RedisClient decorated with prometheus summary metric
func (RedisClientWithPrometheus) FlushAll ¶
func (_d RedisClientWithPrometheus) FlushAll(ctx context.Context) (err error)
FlushAll implements RedisClient