Documentation
¶
Index ¶
Constants ¶
const NOT_FOUND_ERR string = "value not found in store"
Variables ¶
This section is empty.
Functions ¶
func NotFoundWithCause ¶
Types ¶
type InvalidateOption ¶
type InvalidateOption func(o *InvalidateOptions)
InvalidateOption represents a cache invalidation function.
func WithInvalidateTags ¶
func WithInvalidateTags(tags []string) InvalidateOption
WithInvalidateTags allows setting the invalidate tags.
type InvalidateOptions ¶
type InvalidateOptions struct {
Tags []string
}
func ApplyInvalidateOptions ¶
func ApplyInvalidateOptions(opts ...InvalidateOption) *InvalidateOptions
func ApplyInvalidateOptionsWithDefault ¶
func ApplyInvalidateOptionsWithDefault(defaultOptions *InvalidateOptions, opts ...InvalidateOption) *InvalidateOptions
type InvalidateOptionsMatcher ¶
type InvalidateOptionsMatcher struct {
Tags []string
}
func (InvalidateOptionsMatcher) Matches ¶
func (m InvalidateOptionsMatcher) Matches(x interface{}) bool
func (InvalidateOptionsMatcher) String ¶
func (m InvalidateOptionsMatcher) String() string
type Option ¶
type Option func(o *Options)
Option represents a store option function.
func WithClientSideCaching ¶
WithClientSideCaching allows setting the client side caching, enabled by default Currently to be used by Rueidis(redis) library only.
func WithCost ¶
WithCost allows setting the memory capacity used by the item when setting a value. Actually it seems to be used by Ristretto library only.
func WithExpiration ¶
WithExpiration allows to specify an expiration time when setting a value.
func WithSynchronousSet ¶ added in v4.1.6
func WithSynchronousSet() Option
WithSynchronousSet allows setting the behavior when setting a value, whether to wait until all buffered writes have been applied or not. Currently to be used by Ristretto library only.
func WithTagsTTL ¶ added in v4.2.1
WithTagsTTL allows to specify a time-to-live parameter for tags
type Options ¶
type Options struct {
SynchronousSet bool
Cost int64
Expiration time.Duration
Tags []string
TagsTTL time.Duration
ClientSideCacheExpiration time.Duration
}
func ApplyOptions ¶
func ApplyOptionsWithDefault ¶
type OptionsMatcher ¶
func (OptionsMatcher) Matches ¶
func (m OptionsMatcher) Matches(x interface{}) bool
func (OptionsMatcher) String ¶
func (m OptionsMatcher) String() string
type StoreInterface ¶
type StoreInterface interface {
Get(ctx context.Context, key any) (any, error)
GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)
Set(ctx context.Context, key any, value any, options ...Option) error
Delete(ctx context.Context, key any) error
Invalidate(ctx context.Context, options ...InvalidateOption) error
Clear(ctx context.Context) error
GetType() string
}
StoreInterface is the interface for all available stores