redis

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrMissingAddress = utils.Error("Missing address")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client *redis.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) Delete

func (c *Client) Delete(key string) error

Delete removes a key

func (*Client) Get

func (c *Client) Get(key string) ([]byte, error)

Get fetch a key

func (*Client) Key

func (c *Client) Key(key string) string

Key assemble key

func (*Client) PruneExpired

func (c *Client) PruneExpired() error

Prune stub method for compatibility with kv.KV interface

func (*Client) Set

func (c *Client) Set(key string, value []byte) error

Set sets a value

func (*Client) SetTTL

func (c *Client) SetTTL(key string, value []byte, ttl time.Duration) error

SetTTL sets a value with custom TTL

func (*Client) TTL

func (c *Client) TTL() time.Duration

Fetch default ttl

type Config

type Config struct {
	Address        string `json:"address"`        // Address of the Client server
	DB             int    `json:"db"`             // DB is the Client database to use
	KeyPrefix      string `json:"keyPrefix"`      // KeyPrefix is the prefix for session keys in Client
	TTL            uint   `json:"ttl"`            // TTl in seconds
	TimeoutSeconds uint   `json:"timeoutSeconds"` // TimeoutSeconds seconds to wait for operation
	secure.DefaultCredentialConfig
	tls.ServerConfig
}

Config

func NewConfig

func NewConfig() *Config

NewConfig returns a default Client configuration

func (*Config) Validate

func (c *Config) Validate() error

Validate Config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL