Documentation
¶
Overview ¶
Package cache provides a set of caching utilities for Go applications.
Index ¶
Constants ¶
View Source
const DefaultDelimiter = ":"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] interface { Get(ctx context.Context, key string) (T, error) GetAndDelete(ctx context.Context, key string) (T, error) Exists(ctx context.Context, key string) error Set(ctx context.Context, key string, value T, expiration ...time.Duration) error Delete(ctx context.Context, key string) error Iterator(ctx context.Context, fn func(ctx context.Context, key string, value T) bool) error Close(ctx context.Context) error }
Cache is the interface that wraps the basic Get, Set, and Delete methods.
type NSCache ¶
type NSCache[T any] interface { Get(ctx context.Context, ns, key string) (T, error) GetAndDelete(ctx context.Context, ns, key string) (T, error) Exists(ctx context.Context, ns, key string) error Set(ctx context.Context, ns, key string, value T, expiration ...time.Duration) error Delete(ctx context.Context, ns, key string) error Iterator(ctx context.Context, ns string, fn func(ctx context.Context, key string, value T) bool) error Close(ctx context.Context) error }
NSCache is the interface that wraps the basic Get, Set, and Delete methods.
type ObjectCache ¶
type ObjectCache interface {
Get(ctx context.Context, key string) (any, error)
GetAndDelete(ctx context.Context, key string) (any, error)
Exists(ctx context.Context, key string) error
Set(ctx context.Context, key string, value any, expiration ...time.Duration) error
Delete(ctx context.Context, key string) error
Iterator(ctx context.Context, fn func(ctx context.Context, key string, value any) bool) error
Close(ctx context.Context) error
}
ObjectCache is the interface that wraps the basic Get, Set, and Delete methods.
type ObjectNSCache ¶
type ObjectNSCache interface {
Get(ctx context.Context, ns, key string) (any, error)
GetAndDelete(ctx context.Context, ns, key string) (any, error)
Exists(ctx context.Context, ns, key string) error
Set(ctx context.Context, ns, key string, value any, expiration ...time.Duration) error
Delete(ctx context.Context, ns, key string) error
Iterator(ctx context.Context, ns string, fn func(ctx context.Context, key string, value any) bool) error
Close(ctx context.Context) error
}
ObjectNSCache is the interface that wraps the basic Get, Set, and Delete methods.
Click to show internal directories.
Click to hide internal directories.