redis

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache containse memory cache storage

func New

func New(client redis.Cmdable) *Cache

New marker wraps redis client

func NewByURL

func NewByURL(host string) (*Cache, error)

NewByURL marker

func (*Cache) Del

func (c *Cache) Del(ctx context.Context, key string) error

Del removes cache item by key

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string, target any) error

Get cached item

func (*Cache) Set

func (c *Cache) Set(ctx context.Context, key string, value any, lifetime time.Duration) error

Set cache item

func (*Cache) TrySet

func (c *Cache) TrySet(ctx context.Context, key string, value any, lifetime time.Duration) error

TrySet only if not exists

Jump to

Keyboard shortcuts

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