cache

package
v0.1.924 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	WCard = "*"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	contract.CacheOperator
}

func NewClient

func NewClient(d Dependencies, opts ClientOptions) (Client, error)

type ClientOption added in v0.1.14

type ClientOption = contract.Opt[ClientOptions]

func WithTimeout added in v0.1.14

func WithTimeout(x time.Duration) ClientOption

type ClientOptions added in v0.1.14

type ClientOptions struct {
	Timeout time.Duration
}

func ApplyClientOptions added in v0.1.14

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool added in v0.1.11

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) BatchFlush added in v0.1.11

func (d *DefaultTool) BatchFlush(ctx context.Context, c []fmt.Stringer) error

BatchFlush removes multiple cache entries by their keys or matching patterns.

func (*DefaultTool) BatchGet added in v0.1.11

func (d *DefaultTool) BatchGet(ctx context.Context, c []fmt.Stringer) ([]contract.CacheHit, error)

BatchGet retrieves multiple cache values for the given keys.

func (*DefaultTool) BatchSet added in v0.1.11

func (d *DefaultTool) BatchSet(ctx context.Context, e map[fmt.Stringer]contract.CacheHit) error

BatchSet stores multiple cache values for the given keys.

func (*DefaultTool) CacheID added in v0.1.11

func (d *DefaultTool) CacheID(ctx context.Context, id string) (contract.CacheID, error)

CacheID returns a cache ID from the given string.

func (*DefaultTool) DecodeHit added in v0.1.11

func (d *DefaultTool) DecodeHit(ctx context.Context, c contract.CacheHit, dst any) error

DecodeHit decodes a cached value into the given destination type.

func (*DefaultTool) Exists added in v0.1.11

func (d *DefaultTool) Exists(ctx context.Context, c fmt.Stringer) (bool, error)

Exists checks if a cache key exists.

func (*DefaultTool) Flush added in v0.1.11

func (d *DefaultTool) Flush(ctx context.Context, c fmt.Stringer) error

Flush removes a single cache entry by key or matching pattern.

func (*DefaultTool) FlushAll added in v0.1.11

func (d *DefaultTool) FlushAll(ctx context.Context) error

FlushAll clears the entire cache.

func (*DefaultTool) Get added in v0.1.11

Get retrieves a cache value for the given key.

func (*DefaultTool) HitFromValue added in v0.1.11

func (d *DefaultTool) HitFromValue(ctx context.Context, v any) (*contract.CacheHit, error)

HitFromValue converts a value into a cache entry.

func (*DefaultTool) Set added in v0.1.11

Set stores a cache value for the given key.

type Dependencies added in v0.1.8

type Dependencies struct {
	C contract.Cacher
	M contract.Marshaler
	U contract.Unmarshaler
}

type Tool added in v0.1.245

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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