redis

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 7 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 redis.Client

func New

func New(options *Options) *Client

func (*Client) Decrement

func (c *Client) Decrement(ctx context.Context, key string, by int64) (int64, error)

Decrement decreases a key's integer value by 'by'.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key string) error

Delete removes a key.

func (*Client) Forever

func (c *Client) Forever(ctx context.Context, key string, value any) error

Forever stores a value indefinitely.

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) (v any, e error)

Get retrieves a value by key or returns contract.ErrNotFound if missing.

func (*Client) Has

func (c *Client) Has(ctx context.Context, key string) (bool, error)

Has checks if key exists.

func (*Client) Increment

func (c *Client) Increment(ctx context.Context, key string, by int64) (int64, error)

Increment increases a key's integer value by 'by'.

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, key string) (v any, e error)

Pull retrieves and deletes a key atomically.

func (*Client) Put

func (c *Client) Put(ctx context.Context, key string, value any, ttl time.Duration) error

Put sets a key with value and TTL.

func (*Client) Remember

func (c *Client) Remember(ctx context.Context, key string, ttl time.Duration, compute func() (any, error)) (any, error)

Remember gets or computes and caches a value with TTL.

func (*Client) RememberForever

func (c *Client) RememberForever(ctx context.Context, key string, compute func() (any, error)) (any, error)

RememberForever caches a computed value indefinitely.

type Options

type Options redis.Options

Jump to

Keyboard shortcuts

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