acache

package module
v0.0.0-...-72fd40f Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 3 Imported by: 1

README

acache

Abstraction for Cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K ~string] interface {
	Get(ctx context.Context, key K) (string, error)
	GetInt64(ctx context.Context, key K) (int64, error)
	GetUint64(ctx context.Context, key K) (uint64, error)
	GetBytes(ctx context.Context, key K) ([]byte, error)
	GetJSON(ctx context.Context, key K, dest any) error
	GetBool(ctx context.Context, key K) (bool, error)
	Set(ctx context.Context, key K, value any, exp time.Duration) error
	SetJSON(ctx context.Context, key K, value any, exp time.Duration) error
	IncrBy(ctx context.Context, key K, value int64) error
	Delete(ctx context.Context, key K) error
	Reset(ctx context.Context) error
	Close() error
}

type Key

type Key string

func (Key) Add

func (k Key) Add(key string) Key

func (Key) FormatAndAdd

func (k Key) FormatAndAdd(a ...any) Key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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