key_value

package
v0.0.0-...-2a43829 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	RedisClient *redis.Client
}

Client is used to manage key-value pairs in Redis.

func New

func New() *Client

New returns a new key-value client.

func (*Client) Decr

func (client *Client) Decr(key string) error

Decr decrements the value of the given key.

func (*Client) Del

func (client *Client) Del(key string) error

Del deletes the given key.

func (*Client) Get

func (client *Client) Get(key string) (string, error)

Get returns the value of the given key.

func (*Client) Incr

func (client *Client) Incr(key string) error

Incr increments the value of the given key.

func (*Client) IsSet

func (client *Client) IsSet(key string) (bool, error)

IsSet checks if the given key is set.

func (*Client) List

func (client *Client) List(pattern string) ([]string, error)

List returns all keys that match the given pattern.

func (*Client) Set

func (client *Client) Set(key string, value interface{}, expiration time.Duration) error

Set sets the value of the given key.

func (*Client) SetNX

func (client *Client) SetNX(key string, value interface{}, expiration time.Duration) (bool, error)

SetNX sets the value of the given key if it does not exist.

func (*Client) SetUpExpirationListener

func (client *Client) SetUpExpirationListener(ctx context.Context, pattern string, handler func(key string) error) error

SetUpExpirationListener sets up a listener for expired key events for every key that matches the given pattern. It is non-blocking and will run in a separate goroutine.

func (*Client) SetXX

func (client *Client) SetXX(key string, value interface{}, expiration time.Duration) (bool, error)

SetXX sets the value of the given key if it exists.

Jump to

Keyboard shortcuts

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