Versions in this module Expand all Collapse all v0 v0.15.0 Oct 16, 2023 Changes in this version + var ErrNotFound = errors.New("not found") + var ErrNotSupported = errors.New("not supported") + func ConcatOptions(options ...S) S + func StringValue(key any) string + type Cache interface + Delete func(ctx context.Context, key K, options ...DeleteOption) error + Get func(ctx context.Context, key K, options ...GetOption) (V, error) + Name func() string + Set func(ctx context.Context, key K, value V, options ...SetOption) error + type CacheRefreshFunc func(ctx context.Context, key K, options RefreshFuncOptions) (V, error) + type CallDefaultOptions interface + OptCallDefaultDeleteOptions func(options ...DeleteOption) + OptCallDefaultGetOptions func(options ...GetOption) + OptCallDefaultSetOptions func(options ...SetOption) + type CallDefaultRefreshOptions interface + OptCallDefaultRefreshOptions func(options ...RefreshOption) + type Codec interface + Decode func(ctx context.Context, data any) (V, error) + Encode func(ctx context.Context, data V) (any, error) + type CodecError struct + Err error + func (e CodecError) Error() string + func (e CodecError) Unwrap() error + type DefaultRefreshOptions interface + OptDefaultRefreshFunc func(refreshFunc CacheRefreshFunc[K, V]) + type DeleteOption = IOption[IDeleteOpt] + func DeleteOptionFunc(f func(any) bool, name string, hash uint64) DeleteOption + type DeleteOptions interface + type GetOption = IOption[IGetOpt] + func GetOptionFunc(f func(any) bool, name string, hash uint64) GetOption + type GetOptions interface + type IDeleteOpt int + type IGetOpt int + type IIsOption struct + type IOption interface + func ConcatOptionsChecker(checker OptionChecker[O, TO], options ...[]IOption[TO]) []IOption[TO] + func ForwardOptionsChecker(checker OptionChecker[O, TO]) []IOption[TO] + type IRefreshOpt int + type IRootOpt int + type ISetOpt int + type InvalidValueTypeError struct + Message string + func (e *InvalidValueTypeError) Error() string + type IsDeleteOption = IIsOption[IDeleteOpt] + type IsGetOption = IIsOption[IGetOpt] + type IsRefreshOption = IIsOption[IRefreshOpt] + type IsRootOption = IIsOption[IRootOpt] + type IsSetOption = IIsOption[ISetOpt] + type KeyCodec interface + Convert func(ctx context.Context, key K) (any, error) + type Metrics interface + Error func(ctx context.Context, name string, key any, errorType MetricsErrorType) + Hit func(ctx context.Context, name string, key any) + Miss func(ctx context.Context, name string, key any) + type MetricsErrorType int + const MetricsErrorTypeDecode + const MetricsErrorTypeEncode + const MetricsErrorTypeError + const MetricsErrorTypeGet + const MetricsErrorTypeRefresh + const MetricsErrorTypeSet + type MetricsOptions interface + OptMetrics func(metrics Metrics, name string) + type NameOptions interface + OptName func(name string) + type Option interface + ApplyCacheOpt func(any) bool + CacheOptHash func() uint64 + CacheOptName func() string + type OptionChecker interface + CheckCacheError func() error + CheckCacheOpt func(opt Option) + CheckCacheOptList func() []IOption[TO] + func NewOptionChecker(options ...OA) OptionChecker[IOption[TO], TO] + type OptionNotSupportedError struct + Message string + Option Option + func NewOptionNotSupportedError(option Option) OptionNotSupportedError + func (e OptionNotSupportedError) Error() string + type Options interface + type ParseOptionsResult struct + func ParseOptions(obj any, options ...OA) ParseOptionsResult + func ParseOptionsChecker(checker OptionChecker[O, TO], obj any) ParseOptionsResult + func (r ParseOptionsResult) Err() error + func (r ParseOptionsResult) SelfErr() error + type RefreshCache interface + GetOrRefresh func(ctx context.Context, key K, options ...RefreshOption) (V, error) + type RefreshFuncOptions struct + Data any + type RefreshOption = IOption[IRefreshOpt] + func RefreshOptionFunc(f func(any) bool, name string, hash uint64) RefreshOption + func WithRefreshData(data interface{}) RefreshOption + func WithRefreshFunc(refreshFunc CacheRefreshFunc[K, V]) RefreshOption + func WithRefreshGetOptions(options ...GetOption) RefreshOption + func WithRefreshSetOptions(options ...SetOption) RefreshOption + type RefreshOptions interface + OptData func(data any) + OptFunc func(refreshFunc CacheRefreshFunc[K, V]) + OptGetOptions func(options ...GetOption) + OptSetOptions func(options ...SetOption) + type RootOption = IOption[IRootOpt] + func RootOptionFunc(f func(any) bool, name string, hash uint64) RootOption + func WithCallDefaultDeleteOptions(options ...DeleteOption) RootOption + func WithCallDefaultGetOptions(options ...GetOption) RootOption + func WithCallDefaultRefreshOptions(options ...RefreshOption) RootOption + func WithCallDefaultSetOptions(options ...SetOption) RootOption + func WithDefaultRefreshFunc(refreshFunc CacheRefreshFunc[K, V]) RootOption + func WithMetrics(metrics Metrics, name string) RootOption + func WithName(name string) RootOption + type SetOption = IOption[ISetOpt] + func SetOptionFunc(f func(any) bool, name string, hash uint64) SetOption + func WithSetDuration(duration time.Duration) SetOption + type SetOptions interface + OptDuration func(duration time.Duration) + type ValidationError struct + Err error + func (e ValidationError) Error() string + func (e ValidationError) Unwrap() error + type Validator interface + ValidateGet func(ctx context.Context, data V) error