storage

package
v1.1.59 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const (
	PrefixKey = "__host"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterCache

type AdapterCache interface {
	String() string

	// Core operations (context-aware)
	Get(ctx context.Context, key string) (string, error)
	Set(ctx context.Context, key string, val interface{}, expire int) error
	Del(ctx context.Context, key string) error
	HashGet(ctx context.Context, hk, key string) (string, error)
	HashDel(ctx context.Context, hk, key string) error
	Increase(ctx context.Context, key string) error
	Decrease(ctx context.Context, key string) error
	Expire(ctx context.Context, key string, dur time.Duration) error

	// New methods
	HashSet(ctx context.Context, hk, key string, val interface{}) error
	Exists(ctx context.Context, key string) (bool, error)
	SetNX(ctx context.Context, key string, val interface{}, expire int) (bool, error)
	IncrBy(ctx context.Context, key string, n int64) (int64, error)
	TTL(ctx context.Context, key string) (time.Duration, error)

	// Script execution (enables atomic multi-key operations like IncrBy+Expire)
	RunScript(ctx context.Context, script interface{}, keys []string, args ...interface{}) (interface{}, error)
}

type AdapterLocker

type AdapterLocker interface {
	String() string
	Lock(key string, ttl int64, options *redislock.Options) (*redislock.Lock, error)
}

type AdapterQueue

type AdapterQueue interface {
	String() string
	Append(message Messager) error
	Register(name string, f ConsumerFunc)
	Run()
	Shutdown()
}

type Closer added in v1.1.51

type Closer interface {
	Close() error
}

Closer is the lifecycle interface for cache adapters that hold resources.

type ConsumerFunc

type ConsumerFunc func(Messager) error

type Messager

type Messager interface {
	SetID(string)
	SetStream(string)
	SetValues(map[string]interface{})
	GetID() string
	GetStream() string
	GetValues() map[string]interface{}
	GetPrefix() string
	SetPrefix(string)
	SetErrorCount(count int)
	GetErrorCount() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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