Documentation
¶
Index ¶
- Variables
- type Config
- type OptFunc
- type Persistent
- func (p *Persistent) Close() error
- func (p *Persistent) Del(ctx context.Context, input interface{}) error
- func (p *Persistent) DelByPattern(ctx context.Context, pattern string) error
- func (p *Persistent) Get(ctx context.Context, key string, dest interface{}, query func() error) error
- func (p *Persistent) GetDB() *sqlx.DB
- func (p *Persistent) GetRedis() *redis.Client
- func (p *Persistent) Set(ctx context.Context, key string, ttl time.Duration, value interface{}, ...) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
RedisURL string
Password string
DB int
ConnectTimeout time.Duration
OperationTimeout time.Duration
MaxRetries int
MinRetryBackoff time.Duration
MaxRetryBackoff time.Duration
}
Config holds Redis configuration
type Persistent ¶
type Persistent struct {
// contains filtered or unexported fields
}
Persistent contains the persistent Redis and DB connections
func MustConnect ¶
func MustConnect(db *sqlx.DB, opts ...OptFunc) *Persistent
MustConnect creates a new Persistent instance with default options
func NewWithOptions ¶
func NewWithOptions(db *sqlx.DB, cfg *Config) *Persistent
NewWithOptions creates a new Persistent instance with the given options
func (*Persistent) Close ¶
func (p *Persistent) Close() error
func (*Persistent) DelByPattern ¶
func (p *Persistent) DelByPattern(ctx context.Context, pattern string) error
func (*Persistent) GetDB ¶
func (p *Persistent) GetDB() *sqlx.DB
func (*Persistent) GetRedis ¶
func (p *Persistent) GetRedis() *redis.Client
Click to show internal directories.
Click to hide internal directories.