cache

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoProvidedKey = errors.New("no key was provided at Insert{} request")
	ErrInvalidData   = errors.New("invalid data was provided at Insert{} request")
	ErrNilQuery      = errors.New("provided query must be non-nil")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Advanced *redis.Client
	Ctx      context.Context
}

func NewClient

func NewClient(options *redis.Options) *Client

func (*Client) Cache added in v0.0.3

func (c *Client) Cache(key string, v string, expiration ...time.Duration) error

func (*Client) Get added in v0.0.3

func (c *Client) Get(q *Query) error

func (*Client) Insert added in v0.0.3

func (c *Client) Insert(i *Register) error

func (*Client) Uncache added in v0.0.3

func (c *Client) Uncache(key string) (string, error)

func (*Client) Verify added in v0.0.4

func (c *Client) Verify() error

type Query added in v0.0.2

type Query struct {
	Key    string
	Result any
}

type Register added in v0.0.3

type Register struct {
	Key  string
	Data any

	// If 0, data won't have expiration time
	ExpirationTime time.Duration
}

Jump to

Keyboard shortcuts

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