redis¶
import "github.com/Mini-Vending/go-services/packages/redis"
Index¶
- type Config
- type Connection
- func NewConnection(redisURL string, logger logger.Logger) (*Connection, error)
- func (c *Connection) Client() *redis.Client
- func (c *Connection) Close() error
- func (c *Connection) Ping(ctx context.Context) error
- type Manager
- func NewManager(cfg *Config, logger log.Logger) (*Manager, error)
- func (m *Manager) Close() error
- func (m *Manager) Del(ctx context.Context, keys ...string) error
- func (m *Manager) Exists(ctx context.Context, keys ...string) (int64, error)
- func (m *Manager) Get(ctx context.Context, key string) (string, error)
- func (m *Manager) GetJSON(ctx context.Context, key string, dest interface{}) error
- func (m *Manager) IsNil(err error) bool
- func (m *Manager) Ping(ctx context.Context) error
- func (m *Manager) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (m *Manager) SetJSON(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (m *Manager) WithLogger(logger log.Logger) *Manager
type Config¶
type Config struct {
URL string
}
type Connection¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection¶
func NewConnection(redisURL string, logger logger.Logger) (*Connection, error)
func (*Connection) Client¶
func (c *Connection) Client() *redis.Client
func (*Connection) Close¶
func (c *Connection) Close() error
func (*Connection) Ping¶
func (c *Connection) Ping(ctx context.Context) error
type Manager¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager¶
func NewManager(cfg *Config, logger log.Logger) (*Manager, error)
func (*Manager) Close¶
func (m *Manager) Close() error
func (*Manager) Del¶
func (m *Manager) Del(ctx context.Context, keys ...string) error
func (*Manager) Exists¶
func (m *Manager) Exists(ctx context.Context, keys ...string) (int64, error)
func (*Manager) Get¶
func (m *Manager) Get(ctx context.Context, key string) (string, error)
func (*Manager) GetJSON¶
func (m *Manager) GetJSON(ctx context.Context, key string, dest interface{}) error
func (*Manager) IsNil¶
func (m *Manager) IsNil(err error) bool
func (*Manager) Ping¶
func (m *Manager) Ping(ctx context.Context) error
func (*Manager) Set¶
func (m *Manager) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
func (*Manager) SetJSON¶
func (m *Manager) SetJSON(ctx context.Context, key string, value interface{}, expiration time.Duration) error
func (*Manager) WithLogger¶
func (m *Manager) WithLogger(logger log.Logger) *Manager
Generated by gomarkdoc