cache

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 1 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 interface {
	Set(ctx context.Context, key, val string) error
	Get(ctx context.Context, key string) (string, error)
	Delete(ctx context.Context, key string) error
	GetBytes(ctx context.Context, key string) ([]byte, error)
	SetTimed(ctx context.Context, key, val string, ttl int64) error
	SetTimedInt64(ctx context.Context, key string, val int64, ttl int64) error
	SetInt64(ctx context.Context, key string, val int64) error
	SetTTL(ctx context.Context, key string, ttl int64) error
	Incr(ctx context.Context, key string) (int64, error)
	GetInt64(ctx context.Context, key string) (int64, error)
	SetJSON(ctx context.Context, key string, val interface{}) error
	SetTimedJSON(ctx context.Context, key string, val interface{}, ttl int64) error
	// SetTimedJSONNX marshals val and sets it only if the key does not already exist (SET NX).
	// Returns true if the key was set, false if it already existed.
	SetTimedJSONNX(ctx context.Context, key string, val interface{}, ttl int64) (bool, error)
	GetJSON(ctx context.Context, key string, v interface{}) error
	HGet(ctx context.Context, key, field string) (string, error)
	HSet(ctx context.Context, key, field, value string) error
	HDel(ctx context.Context, key, field string) error
	HGetAll(ctx context.Context, key string) (map[string]string, error)
	XAdd(ctx context.Context, stream string, maxLen int64, approx bool, values map[string]interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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