cache

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cache implements a basic redis cache.

Index

Constants

View Source
const ErrRedisNil = redis.Nil

ErrRedisNil is returned when a key is not found in redis.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a cache implementation.

func New

func New(url string, ctx context.Context) (*Cache, error)

New initializes a new cache.

func (*Cache) Close

func (c *Cache) Close() error

Close closes the cache.

func (*Cache) Get

func (c *Cache) Get(key string) (string, error)

Get gets a value from the cache.

func (*Cache) Set

func (c *Cache) Set(key string, value any, ttl time.Duration) error

Set sets a value in the cache.

Jump to

Keyboard shortcuts

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